|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BoundedRangeModel
Defines the data model used by components like ProgressBars.
Defines four interrelated integer properties: minimum, maximum, extent and value. These four integers define two nested ranges like this:
The outer range isminimum <= value <= value+extent <= maximum
minimum,maximum
and the inner
range is value,value+extent
. The inner range
must lie within the outer one, i.e. value
must be
less than or equal to maximum
and value+extent
must greater than or equal to minimum
, and maximum
must be greater than or equal to minimum
.
value == maximum
, setExtent(10)
would change the extent (back) to zero.
Method Summary | |
---|---|
void |
addChangeListener(ChangeListener cl)
Adds a ChangeListener to the model's listener list. |
int |
getExtent()
Returns the model's extent, the length of the inner range that begins at the model's value. |
int |
getMaximum()
Returns the model's maximum. |
int |
getMinimum()
Returns the minimum acceptable value. |
int |
getValue()
Returns the model's current value. |
boolean |
getValueIsAdjusting()
Returns true if the current changes to the value property are part of a series of changes. |
void |
removeChangeListener(ChangeListener cl)
Removes a ChangeListener from the model's listener list. |
void |
setExtent(int newExtent)
Sets the model's extent. |
void |
setMaximum(int newMaximum)
Sets the model's maximum to newMaximum. |
void |
setMinimum(int newMinimum)
Sets the model's minimum to newMinimum. |
void |
setRangeProperties(int value,
int extent,
int min,
int max,
boolean adjusting)
This method sets all of the model's data with a single method call. |
void |
setValue(int newValue)
Sets the model's current value to newValue if newValue
satisfies the model's constraints. |
void |
setValueIsAdjusting(boolean b)
This attribute indicates that any upcoming changes to the value of the model should be considered a single event. |
Method Detail |
---|
void addChangeListener(ChangeListener cl)
cl
- the ChangeListener to addint getExtent()
int getMaximum()
int getMinimum()
int getValue()
maximum - extent
and the lower limit is minimum
.
boolean getValueIsAdjusting()
void removeChangeListener(ChangeListener cl)
void setExtent(int newExtent)
When a BoundedRange model is used with a scrollbar the extent defines the length of the scrollbar knob (aka the "thumb" or "elevator"). The extent usually represents how much of the object being scrolled is visible. When used with a slider, the extent determines how much the value can "jump", for example when the user presses PgUp or PgDn.
Notifies any listeners if the model changes.
void setMaximum(int newMaximum)
minimum <= value <= value+extent <= maximum
Notifies any listeners if the model changes.
void setMinimum(int newMinimum)
minimum <= value <= value+extent <= maximum
Notifies any listeners if the model changes.
void setRangeProperties(int value, int extent, int min, int max, boolean adjusting)
void setValue(int newValue)
newValue
if newValue
satisfies the model's constraints. Those constraints are:
Otherwise, ifminimum <= value <= value+extent <= maximum
newValue
is less than minimum
it's set to minimum
, if its greater than
maximum
then it's set to maximum
, and
if it's greater than value+extent
then it's set to
value+extent
.
When a BoundedRange model is used with a scrollbar the value specifies the origin of the scrollbar knob (aka the "thumb" or "elevator"). The value usually represents the origin of the visible part of the object being scrolled.
Notifies any listeners if the model changes.
void setValueIsAdjusting(boolean b)
b
- true if the upcoming changes to the value property are part of a series
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |