This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing
class DefaultBoundedRangeModel

java.lang.Object extended by javax.swing.DefaultBoundedRangeModel
All Implemented Interfaces:
Serializable, BoundedRangeModel

Most common way to construct:

DefaultBoundedRangeModel model = new DefaultBoundedRangeModel();

Based on 7 examples


public class DefaultBoundedRangeModel
extends Object
implements BoundedRangeModel, Serializable

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 {@link java.beans.XMLEncoder}.


Field Summary
protected transient ChangeEvent changeEvent
          Only one ChangeEvent is 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 Summary

          Initializes all of the properties with default values.
DefaultBoundedRangeModel(int value, int extent, int min, int max)

          Initializes value, extent, minimum and maximum.
 
Method Summary
 void

          Adds a ChangeListener.
protected void

          Runs each ChangeListener's stateChanged method.
 ChangeListener[]

          Returns an array of all the change listeners registered on this DefaultBoundedRangeModel.
 int

          Returns the model's extent.
 EventListener[]
getListeners(Class listenerType)

          Returns an array of all the objects currently registered as FooListeners upon this model.
 int

          Returns the model's maximum.
 int

          Returns the model's minimum.
 int

          Returns the model's current value.
 boolean

          Returns true if the value is in the process of changing as a result of actions being taken by the user.
 void

          Removes a ChangeListener.
 void
setExtent(int n)

          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(int n)

          Sets the maximum to n after ensuring that n that the other three properties obey the model's constraints:
 void
setMinimum(int n)

          Sets the minimum to n after ensuring that n that the other three properties obey the model's constraints:
 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:
 void
setValue(int n)

          Sets the current value of the model.
 void

          Sets the valueIsAdjusting property.
 String

          Returns a string that displays all of the BoundedRangeModel properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

changeEvent

protected transient ChangeEvent changeEvent
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".

listenerList

protected EventListenerList listenerList
The listeners waiting for model changes.
Constructor Detail

DefaultBoundedRangeModel

public DefaultBoundedRangeModel()
Initializes all of the properties with default values. Those values are:


DefaultBoundedRangeModel

public DefaultBoundedRangeModel(int value,
                                int extent,
                                int min,
                                int max)
Initializes value, extent, minimum and maximum. Adjusting is false. Throws an IllegalArgumentException if the following constraints aren't satisfied:
 min <= value <= value+extent <= max
 

Parameters:
value
extent
min
max
Method Detail

addChangeListener

public void addChangeListener(ChangeListener l)
Adds a ChangeListener. The change listeners are run each time any one of the Bounded Range model properties changes.

Parameters:
l - the ChangeListener to add

fireStateChanged

protected void fireStateChanged()
Runs each ChangeListener's stateChanged method.


getChangeListeners

public ChangeListener[] getChangeListeners()
Returns an array of all the change listeners registered on this DefaultBoundedRangeModel.

Returns:
all of this model's ChangeListeners or an empty array if no change listeners are currently registered

getExtent

public int getExtent()
Returns the model's extent.

Returns:
the model's extent

getListeners

public EventListener[] getListeners(Class listenerType)
Returns an array of all the objects currently registered as 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.

Parameters:
listenerType - the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
Returns:
an array of all objects registered as FooListeners on this model, or an empty array if no such listeners have been added

getMaximum

public int getMaximum()
Returns the model's maximum.

Returns:
the model's maximum

getMinimum

public int getMinimum()
Returns the model's minimum.

Returns:
the model's minimum

getValue

public int getValue()
Returns the model's current value.

Returns:
the model's current value

getValueIsAdjusting

public boolean getValueIsAdjusting()
Returns true if the value is in the process of changing as a result of actions being taken by the user.

Returns:
the value of the valueIsAdjusting property

removeChangeListener

public void removeChangeListener(ChangeListener l)
Removes a ChangeListener.

Parameters:
l - the ChangeListener to remove

setExtent

public void setExtent(int n)
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
 

Parameters:
n

setMaximum

public void setMaximum(int n)
Sets the maximum to n after ensuring that n that the other three properties obey the model's constraints:
     minimum <= value <= value+extent <= maximum
 

Parameters:
n

setMinimum

public void setMinimum(int n)
Sets the minimum to n after ensuring that n that the other three properties obey the model's constraints:
     minimum <= value <= value+extent <= maximum
 

Parameters:
n

setRangeProperties

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.

Parameters:
newValue
newExtent
newMin
newMax
adjusting

setValue

public void setValue(int n)
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
 

Parameters:
n

setValueIsAdjusting

public void setValueIsAdjusting(boolean b)
Sets the valueIsAdjusting property.

Parameters:
b

toString

public String toString()
Returns a string that displays all of the BoundedRangeModel properties.

Overrides:
toString in class Object


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.