Class DefaultBoundedRangeModel

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

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 JavaBeans has been added to the java.beans package. Please see XMLEncoder.

Since:
1.2
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected ChangeEvent
    Only one ChangeEvent is needed per model instance since the event's only (read-only) state is the source property.
    The listeners waiting for model changes.
  • Constructor Summary

    Constructors
    Constructor
    Description
    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

    Modifier and Type
    Method
    Description
    void
    Adds a ChangeListener.
    protected void
    Runs each ChangeListener's stateChanged method.
    Returns an array of all the change listeners registered on this DefaultBoundedRangeModel.
    int
    Returns the model's extent.
    <T extends EventListener>
    T[]
    getListeners(Class<T> 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.
    Returns a string that displays all of the BoundedRangeModel properties.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
  • Field Details

    • 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 Details

    • DefaultBoundedRangeModel

      public DefaultBoundedRangeModel()
      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)
      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 - an int giving the current value
      extent - the length of the inner range that begins at the model's value
      min - an int giving the minimum value
      max - an int giving the maximum value
  • Method Details