Solved

View the current row in a JdbTable

Posted on 2003-11-12
11
325 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
 

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now