JavaTM 2 Platform
Standard Edition

javax.swing.colorchooser
Class DefaultColorSelectionModel

java.lang.Object
  |
  +--javax.swing.colorchooser.DefaultColorSelectionModel

public class DefaultColorSelectionModel
extends Object
implements ColorSelectionModel, Serializable

A generic implementation of ColorSelectionModel.

See Also:
Color, 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
           
 
Constructor Summary
DefaultColorSelectionModel()
          Default constructor.
DefaultColorSelectionModel(Color color)
          Initializes selectedColor to color
 
Method Summary
 void addChangeListener(ChangeListener l)
          Adds a ChangeListener to the model.
protected  void fireStateChanged()
          Run each ChangeListeners stateChanged() method.
 Color getSelectedColor()
           
 void removeChangeListener(ChangeListener l)
          Removes a ChangeListener from the model.
 void setSelectedColor(Color color)
          Sets the model's selected color to color.
 
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
Constructor Detail

DefaultColorSelectionModel

public DefaultColorSelectionModel()
Default constructor. Initializes selectedColor to Color.white

DefaultColorSelectionModel

public DefaultColorSelectionModel(Color color)
Initializes selectedColor to color
Method Detail

getSelectedColor

public Color getSelectedColor()
Specified by:
getSelectedColor in interface ColorSelectionModel
Tags copied from interface: ColorSelectionModel
Returns:
the model's selection.
See Also:
ColorSelectionModel.setSelectedColor(java.awt.Color)

setSelectedColor

public void setSelectedColor(Color color)
Description copied from interface: ColorSelectionModel
Sets the model's selected color to color. Notifies any listeners if the model changes
Specified by:
setSelectedColor in interface ColorSelectionModel
Tags copied from interface: ColorSelectionModel
See Also:
ColorSelectionModel.getSelectedColor(), ColorSelectionModel.addChangeListener(javax.swing.event.ChangeListener)

addChangeListener

public void addChangeListener(ChangeListener l)
Adds a ChangeListener to the model.
Specified by:
addChangeListener in interface ColorSelectionModel

removeChangeListener

public void removeChangeListener(ChangeListener l)
Removes a ChangeListener from the model.
Specified by:
removeChangeListener in interface ColorSelectionModel

fireStateChanged

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

JavaTM 2 Platform
Standard Edition

Submit a bug or feature
Java, Java 2D, and JDBC are a trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.