• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Scroll locking using JTables

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author
Posts: 986
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic