Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Scroll locking using JTables

 
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
 
Author
Posts: 974
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 ]
 
The only thing that kept the leeches off of me was this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic