Two Laptop Bag
The moose likes Swing / AWT / SWT and the fly likes Moving Scroll Bar in Scroll Pane when new Line added to JTable in ScrollPane Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Moving Scroll Bar in Scroll Pane when new Line added to JTable in ScrollPane" Watch "Moving Scroll Bar in Scroll Pane when new Line added to JTable in ScrollPane" New topic
Author

Moving Scroll Bar in Scroll Pane when new Line added to JTable in ScrollPane

Jeff Holmes
Ranch Hand

Joined: Oct 04, 2000
Posts: 44
I have a ScrollPane that contains a JTable, I add a new line to the Jtable and the viewable area is to big, so the scroll area stays at the top of the jTable. I want to move to the bottom of the scroll pane as soon as the line is added. Here is the line that I have:
jScrollPane1.getVerticalScrollBar().setValue(jScrollPane1.getVerticalScrollBar().getVisibleAmount());
I have also tried:
jScrollPane1.getVerticalScrollBar().setValue(jScrollPane1.getVerticalScrollBar().getMaximum());
This does not work right after adding the line to the jTable. But I do hava a JButton when action is performed runs the same code, and WORKS! I can not figure this out... Any help would be appreciated, Thanks, Jeff
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Moving Scroll Bar in Scroll Pane when new Line added to JTable in ScrollPane
 
Similar Threads
JTable
jwindow, jscrollpane and jtable + mouse cursor
JTable
Row Selection problems with JTable
JSplitPane, JTable