Solved

View the current row in a JdbTable

Posted on 2003-11-12
11
353 Views
Last Modified: 2010-03-31
For example, if I have a 10 row jdbtable height view, and I'm in the row 20.
How do I do to programmaticaly send the view to the row 1? I mean, put the row 1 as the current in the jdbtable and show it like it.

Thanks.
0
Comment
Question by:paredes_mynor
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 2

Expert Comment

by:SuperKarateMonkey
ID: 9734000
How can you have a 10 row table and be at row 20?
0
 

Author Comment

by:paredes_mynor
ID: 9734018
Maybe I didn't explain it well.  I have a Table scroll pane, with a 10 row height view, and a jdbtable with "n" number of rows.  I'm scrolled down in row 20, and I want to set row no. 1 to be the current.

Thanks.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9734185
You'll need to figure out the height of your rows, the use the setScrollPosition() in the ScrollPane.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:paredes_mynor
ID: 9734272
I'm sorry, I didn't undestand your answer.  Another thing, there's no setScrollPosition() method in either JdbTable or TableScrollPane classes.
Thanks.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9734302
Ah.  TableScrollPane.  Hmm.  I thought you meant a JScrollPane containing your Table.  Sorry.

Is there no equivalent in your TableScrollPane (eg. setVisibleRow() or scrollToRow() or anything like that)?

I've never used the class, so it's just a thought.
0
 

Author Comment

by:paredes_mynor
ID: 9734356
No, there's none similar to those.  I'll continue looking.  If you find something, I'll appreciate that a lot.
Thks.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9734472
According to this page:

http://pipin.tmd.ns.ac.yu/extra/java2/libs/dbswing/ref/dbswing/com.borland.dbswing.TableScrollPane.html

TableScrollPane extends JScrollPane, so it should have inherited the setScrollPosition() method (unless I've got the wrong TableScrollPane ;-))
0
 

Author Comment

by:paredes_mynor
ID: 9734517
Yes, you're right.  But there's no setScrollPosition() method.  The one that has setScrollPosition() is ScrollPane class, and JScrollPane extends JComponent, that is another branch from java.awt.Container.  Both ScrollPane and JComponent extend java.awt.Container at the same level.

0
 
LVL 15

Accepted Solution

by:
jimmack earned 50 total points
ID: 9734647
You're absolutely right.  My apologies.  I'm losing it here.  I could have sworn I was looking at JScrollPane, but obviously not :-(
0
 
LVL 92

Assisted Solution

by:objects
objects earned 200 total points
ID: 9735355
Use :

table.scrollRectToVisible(new Rectangle(0, 0, 1, 1));

And if you want to select the row:

table.setRowSelectionInterval(0, 0);
0
 
LVL 92

Expert Comment

by:objects
ID: 9735460
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jboss wildfly 10.1 10 228
jsp insert to database example 2 45
jmss example java 2 23
Setup GlassFish 4 21
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question