Solved

Automatically scroll to the selected row in JTable/JScrollPane

Posted on 2004-08-31
2
925 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
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…

726 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