public class DefaultColorSelectionModel extends Object implements ColorSelectionModel, Serializable
| Modifier and Type | Field and Description |
|---|---|
protected ChangeEvent |
changeEvent
The ChangeEvent fired to all ChangeListeners.
|
protected EventListenerList |
listenerList
The list of listeners.
|
| Constructor and Description |
|---|
DefaultColorSelectionModel()
Creates a new color selection model with the default white color.
|
DefaultColorSelectionModel(Color color)
Creates a new color selection model with a given selected color.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChangeListener(ChangeListener listener)
Adds a listener to this model.
|
protected void |
fireStateChanged()
Calls all the
stateChanged() method of all added
ChangeListener objects with changeEvent as
argument. |
ChangeListener[] |
getChangeListeners()
Returns all currently added
ChangeListener objects. |
Color |
getSelectedColor()
Returns the selected color.
|
void |
removeChangeListener(ChangeListener listener)
Removes a listener from this model.
|
void |
setSelectedColor(Color color)
This method sets the color.
|
protected transient ChangeEvent changeEvent
protected EventListenerList listenerList
public DefaultColorSelectionModel()
public DefaultColorSelectionModel(Color color)
color - The initial color.Error - If the color is null.public Color getSelectedColor()
getSelectedColor in interface ColorSelectionModelpublic void setSelectedColor(Color color)
setSelectedColor in interface ColorSelectionModelcolor - The color to set.Error - If the color is set.public void addChangeListener(ChangeListener listener)
addChangeListener in interface ColorSelectionModellistener - The listener to add.public void removeChangeListener(ChangeListener listener)
removeChangeListener in interface ColorSelectionModellistener - The listener to remove.public ChangeListener[] getChangeListeners()
ChangeListener objects.ChangeListener objects.protected void fireStateChanged()
stateChanged() method of all added
ChangeListener objects with changeEvent as
argument.