JavaTM 2 Platform
Std. Ed. v1.3.1

javax.swing.colorchooser
Class DefaultColorSelectionModel

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

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
Following copied from interface: javax.swing.colorchooser.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
Following copied from interface: javax.swing.colorchooser.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:
EventListenerList

JavaTM 2 Platform
Std. Ed. v1.3.1

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Oracle and/or its affiliates, in the US and other countries.
Copyright © 1995, 2010 Oracle and/or its affiliates. All rights reserved.