Java Platform 1.2
Beta 4

Class com.sun.java.swing.DefaultBoundedRangeModel

java.lang.Object
  |
  +--com.sun.java.swing.DefaultBoundedRangeModel

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 Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.

See Also:
BoundedRangeModel, Serialized Form

Field Summary
protected  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
DefaultBoundedRangeModel()
          Initializes all of the properties as follows: value = 0 extent = 0 minimum = 0 maximum = 100 adjusting = false
DefaultBoundedRangeModel(int value, int extent, int min, int max)
          Initializes value, extent, minimum and maximum.
 
Method Summary
 void addChangeListener(ChangeListener l)
          Adds a ChangeListener.
protected  void fireStateChanged()
          Run each ChangeListeners stateChanged() method.
 int getExtent()
          Return the model's extent.
 int getMaximum()
          Return the model's maximum.
 int getMinimum()
          Return the model's minimum.
 int getValue()
          Return 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(ChangeListener l)
          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: minimum <= value <= value+extent <= maximum
 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
 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
 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.
 void setValue(int n)
          Sets the current value of the model.
 void setValueIsAdjusting(boolean b)
          Sets the valueIsAdjusting property.
 String toString()
          Returns a string that displays all of the BoundedRangeModel properties.
 
Methods inherited from class java.lang.Object
clone , equals , finalize , getClass , hashCode , notify , notifyAll , 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 as follows:

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
 
Method Detail

getValue

public int getValue()
Return the model's current value.
Specified by:
getValue in interface BoundedRangeModel
Returns:
the model's current value
See Also:
setValue(int), BoundedRangeModel.getValue()

getExtent

public int getExtent()
Return the model's extent.
Specified by:
getExtent in interface BoundedRangeModel
Returns:
the model's extent
See Also:
setExtent(int), BoundedRangeModel.getExtent()

getMinimum

public int getMinimum()
Return the model's minimum.
Specified by:
getMinimum in interface BoundedRangeModel
Returns:
the model's minimum
See Also:
setMinimum(int), BoundedRangeModel.getMinimum()

getMaximum

public int getMaximum()
Return the model's maximum.
Specified by:
getMaximum in interface BoundedRangeModel
Returns:
the model's maximum
See Also:
setMaximum(int), BoundedRangeModel.getMaximum()

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
 
Specified by:
setValue in interface BoundedRangeModel
See Also:
BoundedRangeModel.setValue(int)

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
 
Specified by:
setExtent in interface BoundedRangeModel
See Also:
BoundedRangeModel.setExtent(int)

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
 
Specified by:
setMinimum in interface BoundedRangeModel
See Also:
getMinimum(), BoundedRangeModel.setMinimum(int)

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
 
Specified by:
setMaximum in interface BoundedRangeModel
See Also:
BoundedRangeModel.setMaximum(int)

setValueIsAdjusting

public void setValueIsAdjusting(boolean b)
Sets the valueIsAdjusting property.
Specified by:
setValueIsAdjusting in interface BoundedRangeModel
See Also:
getValueIsAdjusting(), setValue(int), BoundedRangeModel.setValueIsAdjusting(boolean)

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.
Specified by:
getValueIsAdjusting in interface BoundedRangeModel
Returns:
the value of the valueIsAdjusting property
See Also:
setValue(int), BoundedRangeModel.getValueIsAdjusting()

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.

Specified by:
setRangeProperties in interface BoundedRangeModel
See Also:
BoundedRangeModel.setRangeProperties(int, int, int, int, boolean), setValue(int), setExtent(int), setMinimum(int), setMaximum(int), setValueIsAdjusting(boolean)

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.
Specified by:
addChangeListener in interface BoundedRangeModel
Parameters:
l - the ChangeListener to add
See Also:
removeChangeListener(com.sun.java.swing.event.ChangeListener), BoundedRangeModel.addChangeListener(com.sun.java.swing.event.ChangeListener)

removeChangeListener

public void removeChangeListener(ChangeListener l)
Removes a ChangeListener.
Specified by:
removeChangeListener in interface BoundedRangeModel
Parameters:
l - the ChangeListener to remove
See Also:
addChangeListener(com.sun.java.swing.event.ChangeListener), BoundedRangeModel.removeChangeListener(com.sun.java.swing.event.ChangeListener)

fireStateChanged

protected void fireStateChanged()
Run each ChangeListeners stateChanged() method.
See Also:
setRangeProperties(int, int, int, int, boolean), EventListenerList

toString

public String toString()
Returns a string that displays all of the BoundedRangeModel properties.
Overrides:
toString in class Object

Java Platform 1.2
Beta 4

Submit a bug or feature
Submit comments/suggestions about new javadoc look
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.
This documentation was generated with a post-Beta4 version of Javadoc.