Serializable, BoundedRangeModel
public class DefaultBoundedRangeModel extends Object implements BoundedRangeModel, Serializable
 Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans has been added to the java.beans package. Please see XMLEncoder.
| Modifier and Type | Field | Description | 
|---|---|---|
| protected ChangeEvent | changeEvent | Only one  ChangeEventis needed per model instance since the event's only (read-only) state is the source property. | 
| protected EventListenerList | listenerList | The listeners waiting for model changes. | 
| Constructor | Description | 
|---|---|
| DefaultBoundedRangeModel() | Initializes all of the properties with default values. | 
| DefaultBoundedRangeModel | Initializes value, extent, minimum and maximum. | 
| Modifier and Type | Method | Description | 
|---|---|---|
| void | addChangeListener | Adds a  ChangeListener. | 
| protected void | fireStateChanged() | Runs each  ChangeListener'sstateChangedmethod. | 
| ChangeListener[] | getChangeListeners() | Returns an array of all the change listeners registered on this  DefaultBoundedRangeModel. | 
| int | getExtent() | Returns the model's extent. | 
| <T extends EventListener> | getListeners | Returns an array of all the objects currently registered as  FooListeners upon this model. | 
| int | getMaximum() | Returns the model's maximum. | 
| int | getMinimum() | Returns the model's minimum. | 
| int | getValue() | Returns the model's current value. | 
| boolean | getValueIsAdjusting() | Returns true if the value is in the process of changing as a result of actions being taken by the user. | 
| void | removeChangeListener | Removes a  ChangeListener. | 
| void | setExtent | Sets the extent to n after ensuring that n is greater than or equal to zero and falls within the model's constraints: | 
| void | setMaximum | Sets the maximum to n after ensuring that n that the other three properties obey the model's constraints: | 
| void | setMinimum | Sets the minimum to n after ensuring that n that the other three properties obey the model's constraints: | 
| void | setRangeProperties | Sets all of the  BoundedRangeModelproperties after forcing the arguments to obey the usual constraints: | 
| void | setValue | Sets the current value of the model. | 
| void | setValueIsAdjusting | Sets the  valueIsAdjustingproperty. | 
| String | toString() | Returns a string that displays all of the  BoundedRangeModelproperties. | 
protected transient ChangeEvent changeEvent
ChangeEvent is needed per model instance since the event's only (read-only) state is the source property. The source of events generated here is always "this".protected EventListenerList listenerList
public DefaultBoundedRangeModel()
value = 0 extent = 0 minimum = 0 maximum = 100 adjusting = false public DefaultBoundedRangeModel(int value, int extent, int min, int max)
IllegalArgumentException if the following constraints aren't satisfied: min <= value <= value+extent <= max
value - an int giving the current valueextent - the length of the inner range that begins at the model's valuemin - an int giving the minimum valuemax - an int giving the maximum valuepublic int getValue()
getValue in interface BoundedRangeModel
public int getExtent()
getExtent in interface BoundedRangeModel
public int getMinimum()
getMinimum in interface BoundedRangeModel
public int getMaximum()
getMaximum in interface BoundedRangeModel
public void setValue(int n)
     minimum <= value <= value+extent <= maximum
 
setValue in interface BoundedRangeModel
n - the model's new valuepublic void setExtent(int n)
     minimum <= value <= value+extent <= maximum
 
setExtent in interface BoundedRangeModel
n - the model's new extentpublic void setMinimum(int n)
     minimum <= value <= value+extent <= maximum
 
setMinimum in interface BoundedRangeModel
n - the model's new minimumpublic void setMaximum(int n)
     minimum <= value <= value+extent <= maximum
 
setMaximum in interface BoundedRangeModel
n - the model's new maximumpublic void setValueIsAdjusting(boolean b)
valueIsAdjusting property.setValueIsAdjusting in interface BoundedRangeModel
b - true if the upcoming changes to the value property are part of a seriespublic boolean getValueIsAdjusting()
getValueIsAdjusting in interface BoundedRangeModel
valueIsAdjusting propertypublic void setRangeProperties(int newValue, int newExtent, int newMin, int newMax, boolean adjusting)
BoundedRangeModel properties after forcing the arguments to obey the usual constraints: 
     minimum <= value <= value+extent <= maximum
   At most, one ChangeEvent is generated.
setRangeProperties in interface BoundedRangeModel
newValue - an int giving the current valuenewExtent - an int giving the amount by which the value can "jump"newMin - an int giving the minimum valuenewMax - an int giving the maximum valueadjusting - a boolean, true if a series of changes are in progresspublic void addChangeListener(ChangeListener l)
ChangeListener. The change listeners are run each time any one of the Bounded Range model properties changes.addChangeListener in interface BoundedRangeModel
l - the ChangeListener to addpublic void removeChangeListener(ChangeListener l)
ChangeListener.removeChangeListener in interface BoundedRangeModel
l - the ChangeListener to removepublic ChangeListener[] getChangeListeners()
DefaultBoundedRangeModel.ChangeListeners or an empty array if no change listeners are currently registeredprotected void fireStateChanged()
ChangeListener's stateChanged method.public String toString()
BoundedRangeModel properties.public <T extends EventListener> T[] getListeners(Class<T> listenerType)
FooListeners upon this model. FooListeners are registered using the addFooListener method.  You can specify the listenerType argument with a class literal, such as FooListener.class. For example, you can query a DefaultBoundedRangeModel instance m for its change listeners with the following code: 
ChangeListener[] cls = (ChangeListener[])(m.getListeners(ChangeListener.class));If no such listeners exist, this method returns an empty array.
T - the type of EventListener class being requestedlistenerType - the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
FooListeners on this model, or an empty array if no such listeners have been addedClassCastException - if listenerType doesn't specify a class or interface that implements java.util.EventListener
    © 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
    https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/DefaultBoundedRangeModel.html