Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.geotools.gui.swing
Class AutoScroll  view AutoScroll download AutoScroll.java

java.lang.Object
  extended byorg.geotools.gui.swing.AutoScroll
All Implemented Interfaces:
javax.swing.event.ChangeListener, java.util.EventListener, java.io.Serializable

final class AutoScroll
extends java.lang.Object
implements javax.swing.event.ChangeListener, java.io.Serializable

Scroll down a panel when new lines are added. This helper class require only the reference to the underlying javax.swing.BoundedRangeModel. If the model's value is equals to its maximal value and this maximal value increase, then this class increase the model's value as well. Example of use:

 DefaultTableModel table = new DefaultTableModel();
 JScrollPane pane = new JScrollPane(new JTable(table));
 AutoScroll autos = new AutoScrool(pane.getVerticalScrollBar().getModel());
 // etc...

 // Now, add the new item to the table. The table
 // will be scrolled down automatically if needed.
 table.addRow(...);
 

Version:
$Id: AutoScroll.java,v 1.5 2003/02/09 23:38:11 lbruand Exp $

Field Summary
static java.lang.String CVSID
           
private  int extent
          Properties of the javax.swing.BoundedRangeModel the last time sync() 55 has been invoked.
private  int maximum
          Properties of the javax.swing.BoundedRangeModel the last time sync() 55 has been invoked.
private  javax.swing.BoundedRangeModel model
          The model for the vertical scrollbar.
private static long serialVersionUID
          Serial number for interoperability with different versions.
private  int value
          Properties of the javax.swing.BoundedRangeModel the last time sync() 55 has been invoked.
 
Constructor Summary
AutoScroll(javax.swing.BoundedRangeModel model)
          Construct a new AutoScroll for the specified model.
 
Method Summary
 void dispose()
          Dispose any resources hold by this object.
 void stateChanged(javax.swing.event.ChangeEvent event)
          Invoked automatically when the upper limit of javax.swing.BoundedRangeModel has increased.
private  void sync()
          Copy current model's state into value 55 , extent 55 and maximum 55 fields.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CVSID

public static final java.lang.String CVSID
See Also:
Constant Field Values

serialVersionUID

private static final long serialVersionUID
Serial number for interoperability with different versions.

See Also:
Constant Field Values

model

private final javax.swing.BoundedRangeModel model
The model for the vertical scrollbar.


value

private int value
Properties of the javax.swing.BoundedRangeModel the last time sync() 55 has been invoked.


extent

private int extent
Properties of the javax.swing.BoundedRangeModel the last time sync() 55 has been invoked.


maximum

private int maximum
Properties of the javax.swing.BoundedRangeModel the last time sync() 55 has been invoked.

Constructor Detail

AutoScroll

public AutoScroll(javax.swing.BoundedRangeModel model)
Construct a new AutoScroll for the specified model.

Method Detail

dispose

public void dispose()
Dispose any resources hold by this object. This method deregisters any listeners.


sync

private void sync()
Copy current model's state into value 55 , extent 55 and maximum 55 fields.


stateChanged

public void stateChanged(javax.swing.event.ChangeEvent event)
Invoked automatically when the upper limit of javax.swing.BoundedRangeModel has increased. If the last row was visible prior the addition of new rows, then this method scrolls down the model in order to show the new rows.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener