javax.swing.colorchooser
public class DefaultColorSelectionModel extends Object implements ColorSelectionModel, Serializable
Field Summary | |
---|---|
protected ChangeEvent | changeEvent The ChangeEvent fired to all ChangeListeners. |
protected EventListenerList | listenerList The list of listeners. |
Constructor Summary | |
---|---|
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.
|
Method Summary | |
---|---|
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.
|
Parameters: color The initial color.
Throws: Error If the color is null.
Parameters: listener The listener to add.
stateChanged()
method of all added
ChangeListener
objects with changeEvent
as
argument.ChangeListener
objects.
Returns: Array of ChangeListener
objects.
Returns: The selected color.
Parameters: listener The listener to remove.
Parameters: color The color to set.
Throws: Error If the color is set.