Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Scroll locking using JTables  RSS feed

 
Oliver Stagg
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Does anyone know if you can lock the scroll bar of a JScrollPane when the model of a JTable receives an update? I still want the table to display the new data, but I don't necessarily want the scroll bar moved to make it visible.

I�ve implemented features to lock the scroll bar at the top and bottom of a table when an update is received, but now I need the scroll bar to remain locked in place when a updated is made.

Kind regards

Oliver
 
Brian Cole
Author
Ranch Hand
Posts: 932
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Oliver Stagg:
Does anyone know if you can lock the scroll bar of a JScrollPane when the model of a JTable receives an update? I still want the table to display the new data, but I don't necessarily want the scroll bar moved to make it visible.


I'm not sure what exactly you mean by receives an update, but JTable does not generally scroll to make updates to its model [in the sense of AbstractTableModel.fireTableRowsUpdated()] visible. The only times JTable scrolls automatically are on selection changes or on user mouse drags, and then only when the table's autoscrolls property is true.

If you have a JTable that is scrolling when its model updates, I would guess someone has explicitly added code to make that happen. (Or I suppose it's possible you are using an unusual LnF that does it.)
[ April 14, 2008: Message edited by: Brian Cole ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!