Scroll down a panel when new lines are added. This helper class require only the reference
to the underlying
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(...);
Invoked automatically when the upper limit of
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.