Solved

Automatically scroll to the selected row in JTable/JScrollPane

Posted on 2004-08-31
2
908 Views
Last Modified: 2012-06-27
I have a program that populates values in a JTable, then sets then selected row. That works fine, but if the number of rows visible without scrolling is say 10 for example, and the the selected row of the table is 90, you need to either scroll manually to see the selection, or press up arrow key, to scroll semi-automatically. Is it possible to have the JScrollPane automatically scroll the the proper position to display the selected row of the JTable?

Thank you.
0
Comment
Question by:r0ckteacher
2 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 11946394
0
 
LVL 92

Accepted Solution

by:
objects earned 50 total points
ID: 11946854
table.scrollRectToVisible(table.getCellRect(row, 0, false));
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
fibonacci ten numbers 4 46
jdbc error in jsp application 20 64
Glassfish admin console not working 1 36
Running JavaFX on the Raspberry Pi 27 48
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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 …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

821 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