Class DefaultColorSelectionModel

java.lang.Object
javax.swing.colorchooser.DefaultColorSelectionModel
All Implemented Interfaces:
Serializable, ColorSelectionModel

public class DefaultColorSelectionModel extends Object implements ColorSelectionModel, Serializable
A generic implementation of ColorSelectionModel.
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 listener list.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a DefaultColorSelectionModel with the current color set to Color.white.
    Creates a DefaultColorSelectionModel with the current color set to color, which should be non-null.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a ChangeListener to the model.
    protected void
    Runs each ChangeListener's stateChanged method.
    Returns an array of all the ChangeListeners added to this DefaultColorSelectionModel with addChangeListener.
    Returns the selected Color which should be non-null.
    void
    Removes a ChangeListener from the model.
    void
    Sets the selected color to color.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Creates and returns a copy of this object.
    boolean
    Indicates whether some other object is "equal to" this one.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Finalization is deprecated and subject to removal in a future release.
    final Class<?>
    Returns the runtime class of this Object.
    int
    Returns a hash code value for this object.
    final void
    Wakes up a single thread that is waiting on this object's monitor.
    final void
    Wakes up all threads that are waiting on this object's monitor.
    Returns a string representation of the object.
    final void
    Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
    final void
    wait(long timeoutMillis)
    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
    final void
    wait(long timeoutMillis, int nanos)
    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  • 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 listener list.
  • Constructor Details

    • DefaultColorSelectionModel

      public DefaultColorSelectionModel()
      Creates a DefaultColorSelectionModel with the current color set to Color.white. This is the default constructor.
    • DefaultColorSelectionModel

      public DefaultColorSelectionModel(Color color)
      Creates a DefaultColorSelectionModel with the current color set to color, which should be non-null. Note that setting the color to null is undefined and may have unpredictable results.
      Parameters:
      color - the new Color
  • Method Details