Methods Summary |
---|
public void | addChangeListener(javax.swing.event.ChangeListener l)Adds a ChangeListener to the model.
listenerList.add(ChangeListener.class, l);
|
protected void | fireStateChanged()Runs each ChangeListener 's
stateChanged method.
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -=2 ) {
if (listeners[i] == ChangeListener.class) {
if (changeEvent == null) {
changeEvent = new ChangeEvent(this);
}
((ChangeListener)listeners[i+1]).stateChanged(changeEvent);
}
}
|
public javax.swing.event.ChangeListener[] | getChangeListeners()Returns an array of all the ChangeListener s added
to this DefaultColorSelectionModel with
addChangeListener .
return (ChangeListener[])listenerList.getListeners(
ChangeListener.class);
|
public java.awt.Color | getSelectedColor()Returns the selected Color which should be
non-null .
return selectedColor;
|
public void | removeChangeListener(javax.swing.event.ChangeListener l)Removes a ChangeListener from the model.
listenerList.remove(ChangeListener.class, l);
|
public void | setSelectedColor(java.awt.Color color)Sets the selected color to color .
Note that setting the color to null
is undefined and may have unpredictable results.
This method fires a state changed event if it sets the
current color to a new non-null color;
if the new color is the same as the current color,
no event is fired.
if (color != null && !selectedColor.equals(color)) {
selectedColor = color;
fireStateChanged();
}
|