Thread View: comp.lang.java.gui
1 messages
1 total messages
Started by Paul Wang
Tue, 17 Oct 2000 00:00
JTable scrolling on scroll pane
Author: Paul Wang
Date: Tue, 17 Oct 2000 00:00
Date: Tue, 17 Oct 2000 00:00
17 lines
1601 bytes
1601 bytes
I have a JTable on JScrollPane. When insert a new row to table model, I
want JScrollPane scroll to the bottom to show the newly inserted row.
But it can only scroll to the last row before insertion. Is there anyone
has experience with this kind situation. Thanks.
Paul Wang
pwang@teloptica.com
// scroll to the bottom
JScrollBar sb = tableScrollPane.getVerticalScrollBar();
System.out.println("table row count: " +
table.getRowCount()); // debug
if (table.getRowCount()*table.getRowHeight() >
(sb.getHeight()-sb.getLocation().getY()))
{
sb.setValue((table.getRowCount()+1)*table.getRowHeight());
}
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads