|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjavax.swing.DefaultBoundedRangeModel
com.wordpress.tipsforjava.swing.JumpScrollBarModel
public class JumpScrollBarModel extends DefaultBoundedRangeModel
This class is used to create a scroll bar model which continues to return the initial value as long as the scroll thumb is being dragged, and returns the updated value when it is released, or optionally after a specified delay.
This can be useful in two perceived situations:
If the JumpScrollBarModel is constructed with a reference to
the scroll bar or scroll pane to which it is attached, the original model
can be restored by invoking the class's dispose() method.
| Field Summary | |
|---|---|
private BoundedRangeModel |
oldModel
|
private int |
oldValue
|
private JScrollBar |
scrollBar
|
private Timer |
timer
|
| Constructor Summary | |
JumpScrollBarModel()
Creates a |
|
JumpScrollBarModel(int value, int extent, int min, int max)
Creates a |
|
JumpScrollBarModel(JScrollPane scrollPane)
Creates a |
|
JumpScrollBarModel(JScrollPane scrollPane, int scrollBarType)
Creates a |
|
JumpScrollBarModel(JScrollBar scrollBar)
Creates a |
|
| Method Summary | |
|---|---|
void
|
dispose()
Invoking this method will restore the scroll bar's original model. |
int
|
getJumpInterval()
Returns the jump interval in milliseconds, or -1 if the model does not auto jump. |
int
|
getTrueValue()
Returns the true value of the scroll bar, as retrieved from the superclass. |
int
|
getValue()
Overridden to return the previous value while the scroll bar's value is adjusting, and to return the current value only when not adjusting. |
void
|
setJumpInterval(int interval)
Sets the interval in milliseconds after which the scrollbar will jump if paused at one point. |
static JumpScrollBarModel
|
setJumpScrollBarModel(JScrollPane scrollPane)
Returns a |
static JumpScrollBarModel
|
setJumpScrollBarModel(JScrollPane scrollPane, int scrollBarType)
Returns a |
static JumpScrollBarModel
|
setJumpScrollBarModel(JScrollBar scrollBar)
Returns a |
| Methods inherited from class DefaultBoundedRangeModel | |
|---|---|
| toString, getValue, setValue, getListeners, addChangeListener, removeChangeListener, getChangeListeners, getMinimum, getMaximum, getValueIsAdjusting, setValueIsAdjusting, setMinimum, setMaximum, getExtent, setExtent, setRangeProperties, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll |
| Methods inherited from class Object | |
|---|---|
| wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Field Detail |
|---|
private BoundedRangeModel oldModel
private int oldValue
private JScrollBar scrollBar
private Timer timer
| Constructor Detail |
|---|
public JumpScrollBarModel()
JumpScrollBarModel with all of the properties
set to default values. Those values are:
public JumpScrollBarModel(int value, int extent, int min, int max)
JumpScrollBarModel with the specified value,
extent, minimum and maximum. Adjusting is false.
Throws an IllegalArgumentException if the following constraints aren't
satisfied:
min <= value <= value+extent <= max
value - the valueextent - the extentmin - the minimum of the rangemax - the maximum of the range
public JumpScrollBarModel(JScrollPane scrollPane)
JumpScrollBarModel for the vertical scroll bar
of a JScrollPane. The properties are initialized from the scroll bar's
original model.
scrollPane - the JScrollPane
public JumpScrollBarModel(JScrollPane scrollPane, int scrollBarType)
JumpScrollBarModel for the specified scroll bar
of a JScrollPane. The properties are initialized from the scroll bar's
original model.
scrollPane - the JScrollPanescrollBarType - should be either of
In case of an illegal value, the vertical scroll bar will be selected by default.
public JumpScrollBarModel(JScrollBar scrollBar)
JumpScrollBarModel for a JScrollBar. The
properties are initialized from the scroll bar's original model.
scrollBar - the JScrollBar
| Method Detail |
|---|
public void dispose()
JumpScrollBarModel was constructed without a
reference to a scroll bar or scroll pane, the method will do nothing.
public int getJumpInterval()
public int getTrueValue()
@Override public int getValue()
public void setJumpInterval(int interval)
Any other negative value or 0 will do nothing.
interval - the jump interval, or -1 to stop auto jump.
public static JumpScrollBarModel setJumpScrollBarModel(JScrollPane scrollPane)
JumpScrollBarModel for the vertical scroll bar
of a JScrollPane. The properties are initialized from the scroll bar's
original model.
scrollPane - the JScrollPaneJumpScrollBarModel
public static JumpScrollBarModel setJumpScrollBarModel(JScrollPane scrollPane, int scrollBarType)
JumpScrollBarModel for the specified scroll bar
of a JScrollPane. The properties are initialized from the scroll bar's
original model.
scrollPane - the JScrollPanescrollBarType - should be either of
In case of an illegal value, the vertical scroll bar will be selected by default.
JumpScrollBarModel
public static JumpScrollBarModel setJumpScrollBarModel(JScrollBar scrollBar)
JumpScrollBarModel for a JScrollBar. The
properties are initialized from the scroll bar's original model.
scrollBar - the JScrollBarJumpScrollBarModel
Groovy Documentation