Set position in JScrollPane

allelopath
allelopath used Ask the Experts™
on
I have a JTable in a JScrollpane. Suppose the table has 20 rows and only rows 1-10 are visible in the pane. How would I programmatically make, say, row 15 visible in the pane, with out enlarging the pane?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Thanks for the reply, but that is not what I want to do, and I apologize for not being clear.
Supposing rows 1-10 are visible, I would like, eg. to make rows 5 - 15 visible.
sorry misread your question
I think that you need to get the JViewPort from the JScrollPane Object
and call the setViewPosition() method
http://download.oracle.com/javase/1.4.2/docs/api/javax/swing/JViewport.html#setViewPosition(java.awt.Point)
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Author

Commented:
ok, now we're getting somewhere
So I know that I want to display row 15 of the table
setViewPosition requires a Point.
How do I translate row 15 into a Point?
Top Expert 2016
Commented:
Mick BarryJava Developer
Top Expert 2010

Commented:

Author

Commented:
objects: thx as always for your input, but in this case your link is nearly the same as the previous one from CEHJ
Top Expert 2016

Commented:
:-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial