| |
|
| java.lang.Object javax.swing.DefaultBoundedRangeModel
DefaultBoundedRangeModel | public class DefaultBoundedRangeModel implements BoundedRangeModel,Serializable(Code) | | A generic implementation of BoundedRangeModel.
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 JavaBeansTM
has been added to the java.beans package.
Please see
java.beans.XMLEncoder .
version: 1.54 05/05/07 author: David Kloba author: Hans Muller See Also: BoundedRangeModel |
Method Summary | |
public void | addChangeListener(ChangeListener l) Adds a ChangeListener . | protected void | fireStateChanged() Runs each ChangeListener 's stateChanged method. | public ChangeListener[] | getChangeListeners() Returns an array of all the change listeners
registered on this DefaultBoundedRangeModel . | public int | getExtent() Returns the model's extent. | public T[] | getListeners(Class<T> listenerType) Returns an array of all the objects currently registered as
FooListener s
upon this model. | public int | getMaximum() Returns the model's maximum. | public int | getMinimum() Returns the model's minimum. | public int | getValue() Returns the model's current value. | public boolean | getValueIsAdjusting() Returns true if the value is in the process of changing
as a result of actions being taken by the user. | public void | removeChangeListener(ChangeListener l) Removes a ChangeListener . | public void | setExtent(int n) | public void | setMaximum(int n) | public void | setMinimum(int n) | public void | setRangeProperties(int newValue, int newExtent, int newMin, int newMax, boolean adjusting) Sets all of the BoundedRangeModel properties after forcing
the arguments to obey the usual constraints:
minimum <= value <= value+extent <= maximum
At most, one ChangeEvent is generated. | public void | setValue(int n) Sets the current value of the model. | public void | setValueIsAdjusting(boolean b) Sets the valueIsAdjusting property. | public String | toString() Returns a string that displays all of the
BoundedRangeModel properties. |
changeEvent | protected transient ChangeEvent changeEvent(Code) | | Only one 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".
|
DefaultBoundedRangeModel | public DefaultBoundedRangeModel()(Code) | | Initializes all of the properties with default values.
Those values are:
value = 0
extent = 0
minimum = 0
maximum = 100
adjusting = false
|
DefaultBoundedRangeModel | public DefaultBoundedRangeModel(int value, int extent, int min, int max)(Code) | | Initializes value, extent, minimum and maximum. Adjusting is false.
Throws an IllegalArgumentException if the following
constraints aren't satisfied:
min <= value <= value+extent <= max
|
getListeners | public T[] getListeners(Class<T> listenerType)(Code) | | Returns an array of all the objects currently registered as
FooListener s
upon this model.
FooListener s
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.
Parameters: listenerType - the type of listeners requested;this parameter should specify an interfacethat descends from java.util.EventListener an array of all objects registered asFooListener son this model,or an empty array if no suchlisteners have been added exception: ClassCastException - if listenerType doesn'tspecify a class or interface that implementsjava.util.EventListener See Also: DefaultBoundedRangeModel.getChangeListeners since: 1.3 |
setExtent | public void setExtent(int n)(Code) | | Sets the extent to n after ensuring that n
is greater than or equal to zero and falls within the model's
constraints:
minimum <= value <= value+extent <= maximum
See Also: BoundedRangeModel.setExtent |
setMaximum | public void setMaximum(int n)(Code) | | Sets the maximum to n after ensuring that n
that the other three properties obey the model's constraints:
minimum <= value <= value+extent <= maximum
See Also: BoundedRangeModel.setMaximum |
setValue | public void setValue(int n)(Code) | | Sets the current value of the model. For a slider, that
determines where the knob appears. Ensures that the new
value, n falls within the model's constraints:
minimum <= value <= value+extent <= maximum
See Also: BoundedRangeModel.setValue |
toString | public String toString()(Code) | | Returns a string that displays all of the
BoundedRangeModel properties.
|
|
|
|