BoundedRangeModel (Java SE 19 & JDK 19) (original) (raw)

All Known Implementing Classes:

[DefaultBoundedRangeModel](DefaultBoundedRangeModel.html "class in javax.swing")


public interface BoundedRangeModel

Defines the data model used by components like Sliders and ProgressBars. Defines four interrelated integer properties: minimum, maximum, extent and value. These four integers define two nested ranges like this:

minimum <= value <= value+extent <= maximum

The outer range is 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. There are a few features of this model that one might find a little surprising. These quirks exist for the convenience of the Swing BoundedRangeModel clients, such as Slider andScrollBar.

For an example of specifying custom bounded range models used by sliders, see Separable model architecture in A Swing Architecture Overview.

Since:

1.2

See Also:

void
Adds a ChangeListener to the model's listener list.
int
[getExtent](#getExtent%28%29)()
Returns the model's extent, the length of the inner range that begins at the model's value.
int
Returns the model's maximum.
int
Returns the minimum acceptable value.
int
[getValue](#getValue%28%29)()
Returns the model's current value.
boolean
Returns true if the current changes to the value property are part of a series of changes.
void
Removes a ChangeListener from the model's listener list.
void
[setExtent](#setExtent%28int%29)(int newExtent)
void
[setMaximum](#setMaximum%28int%29)(int newMaximum)
Sets the model's maximum to newMaximum.
void
[setMinimum](#setMinimum%28int%29)(int newMinimum)
Sets the model's minimum to newMinimum.
void
[setRangeProperties](#setRangeProperties%28int,int,int,int,boolean%29)(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](#setValue%28int%29)(int newValue)
Sets the model's current value to newValue if newValue satisfies the model's constraints.
void
[setValueIsAdjusting](#setValueIsAdjusting%28boolean%29)(boolean b)
This attribute indicates that any upcoming changes to the value of the model should be considered a single event.