javax.swing.colorchooser
Class DefaultColorSelectionModel

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.colorchooser.DefaultColorSelectionModel
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , ColorSelectionModel sample code for javax.swing.colorchooser.ColorSelectionModel definition code for javax.swing.colorchooser.ColorSelectionModel

public class DefaultColorSelectionModel
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements ColorSelectionModel sample code for javax.swing.colorchooser.ColorSelectionModel definition code for javax.swing.colorchooser.ColorSelectionModel , Serializable sample code for java.io.Serializable definition code for java.io.Serializable

A generic implementation of ColorSelectionModel.

See Also:
Color sample code for java.awt.Color definition code for java.awt.Color , Serialized Form

Field Summary
protected  ChangeEvent sample code for javax.swing.event.ChangeEvent definition code for javax.swing.event.ChangeEvent changeEvent sample code for javax.swing.colorchooser.DefaultColorSelectionModel.changeEvent definition code for javax.swing.colorchooser.DefaultColorSelectionModel.changeEvent
          Only one ChangeEvent is needed per model instance since the event's only (read-only) state is the source property.
protected  EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList listenerList sample code for javax.swing.colorchooser.DefaultColorSelectionModel.listenerList definition code for javax.swing.colorchooser.DefaultColorSelectionModel.listenerList
           
 
Constructor Summary
DefaultColorSelectionModel sample code for javax.swing.colorchooser.DefaultColorSelectionModel.DefaultColorSelectionModel() definition code for javax.swing.colorchooser.DefaultColorSelectionModel.DefaultColorSelectionModel() ()
          Creates a DefaultColorSelectionModel with the current color set to Color.white.
DefaultColorSelectionModel sample code for javax.swing.colorchooser.DefaultColorSelectionModel.DefaultColorSelectionModel(java.awt.Color) definition code for javax.swing.colorchooser.DefaultColorSelectionModel.DefaultColorSelectionModel(java.awt.Color) (Color sample code for java.awt.Color definition code for java.awt.Color  color)
          Creates a DefaultColorSelectionModel with the current color set to color, which should be non-null.
 
Method Summary
 void addChangeListener sample code for javax.swing.colorchooser.DefaultColorSelectionModel.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.colorchooser.DefaultColorSelectionModel.addChangeListener(javax.swing.event.ChangeListener) (ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
          Adds a ChangeListener to the model.
protected  void fireStateChanged sample code for javax.swing.colorchooser.DefaultColorSelectionModel.fireStateChanged() definition code for javax.swing.colorchooser.DefaultColorSelectionModel.fireStateChanged() ()
          Runs each ChangeListener's stateChanged method.
 ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener [] getChangeListeners sample code for javax.swing.colorchooser.DefaultColorSelectionModel.getChangeListeners() definition code for javax.swing.colorchooser.DefaultColorSelectionModel.getChangeListeners() ()
          Returns an array of all the ChangeListeners added to this DefaultColorSelectionModel with addChangeListener.
 Color sample code for java.awt.Color definition code for java.awt.Color getSelectedColor sample code for javax.swing.colorchooser.DefaultColorSelectionModel.getSelectedColor() definition code for javax.swing.colorchooser.DefaultColorSelectionModel.getSelectedColor() ()
          Returns the selected Color which should be non-null.
 void removeChangeListener sample code for javax.swing.colorchooser.DefaultColorSelectionModel.removeChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.colorchooser.DefaultColorSelectionModel.removeChangeListener(javax.swing.event.ChangeListener) (ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
          Removes a ChangeListener from the model.
 void setSelectedColor sample code for javax.swing.colorchooser.DefaultColorSelectionModel.setSelectedColor(java.awt.Color) definition code for javax.swing.colorchooser.DefaultColorSelectionModel.setSelectedColor(java.awt.Color) (Color sample code for java.awt.Color definition code for java.awt.Color  color)
          Sets the selected color to color.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

changeEvent sample code for javax.swing.colorchooser.DefaultColorSelectionModel.changeEvent

protected transient ChangeEvent sample code for javax.swing.event.ChangeEvent definition code for javax.swing.event.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 sample code for javax.swing.colorchooser.DefaultColorSelectionModel.listenerList

protected EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList  listenerList
Constructor Detail

DefaultColorSelectionModel sample code for javax.swing.colorchooser.DefaultColorSelectionModel() definition code for javax.swing.colorchooser.DefaultColorSelectionModel()

public DefaultColorSelectionModel()
Creates a DefaultColorSelectionModel with the current color set to Color.white. This is the default constructor.


DefaultColorSelectionModel sample code for javax.swing.colorchooser.DefaultColorSelectionModel(java.awt.Color) definition code for javax.swing.colorchooser.DefaultColorSelectionModel(java.awt.Color)

public DefaultColorSelectionModel(Color sample code for java.awt.Color definition code for java.awt.Color  color)
Creates a DefaultColorSelectionModel with the current color set to color, which should be non-null. Note that setting the color to null is undefined and may have unpredictable results.

Parameters:
color - the new Color
Method Detail

getSelectedColor sample code for javax.swing.colorchooser.DefaultColorSelectionModel.getSelectedColor() definition code for javax.swing.colorchooser.DefaultColorSelectionModel.getSelectedColor()

public Color sample code for java.awt.Color definition code for java.awt.Color  getSelectedColor()
Returns the selected Color which should be non-null.

Specified by:
getSelectedColor sample code for javax.swing.colorchooser.ColorSelectionModel.getSelectedColor() definition code for javax.swing.colorchooser.ColorSelectionModel.getSelectedColor() in interface ColorSelectionModel sample code for javax.swing.colorchooser.ColorSelectionModel definition code for javax.swing.colorchooser.ColorSelectionModel
Returns:
the selected Color
See Also:
ColorSelectionModel.setSelectedColor(java.awt.Color) sample code for javax.swing.colorchooser.ColorSelectionModel.setSelectedColor(java.awt.Color) definition code for javax.swing.colorchooser.ColorSelectionModel.setSelectedColor(java.awt.Color)

setSelectedColor sample code for javax.swing.colorchooser.DefaultColorSelectionModel.setSelectedColor(java.awt.Color) definition code for javax.swing.colorchooser.DefaultColorSelectionModel.setSelectedColor(java.awt.Color)

public void setSelectedColor(Color sample code for java.awt.Color definition code for 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.

Specified by:
setSelectedColor sample code for javax.swing.colorchooser.ColorSelectionModel.setSelectedColor(java.awt.Color) definition code for javax.swing.colorchooser.ColorSelectionModel.setSelectedColor(java.awt.Color) in interface ColorSelectionModel sample code for javax.swing.colorchooser.ColorSelectionModel definition code for javax.swing.colorchooser.ColorSelectionModel
Parameters:
color - the new Color
See Also:
ColorSelectionModel.getSelectedColor() sample code for javax.swing.colorchooser.ColorSelectionModel.getSelectedColor() definition code for javax.swing.colorchooser.ColorSelectionModel.getSelectedColor() , ColorSelectionModel.addChangeListener(javax.swing.event.ChangeListener) sample code for javax.swing.colorchooser.ColorSelectionModel.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.colorchooser.ColorSelectionModel.addChangeListener(javax.swing.event.ChangeListener)

addChangeListener sample code for javax.swing.colorchooser.DefaultColorSelectionModel.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.colorchooser.DefaultColorSelectionModel.addChangeListener(javax.swing.event.ChangeListener)

public void addChangeListener(ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
Adds a ChangeListener to the model.

Specified by:
addChangeListener sample code for javax.swing.colorchooser.ColorSelectionModel.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.colorchooser.ColorSelectionModel.addChangeListener(javax.swing.event.ChangeListener) in interface ColorSelectionModel sample code for javax.swing.colorchooser.ColorSelectionModel definition code for javax.swing.colorchooser.ColorSelectionModel
Parameters:
l - the ChangeListener to be added

removeChangeListener sample code for javax.swing.colorchooser.DefaultColorSelectionModel.removeChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.colorchooser.DefaultColorSelectionModel.removeChangeListener(javax.swing.event.ChangeListener)

public void removeChangeListener(ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
Removes a ChangeListener from the model.

Specified by:
removeChangeListener sample code for javax.swing.colorchooser.ColorSelectionModel.removeChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.colorchooser.ColorSelectionModel.removeChangeListener(javax.swing.event.ChangeListener) in interface ColorSelectionModel sample code for javax.swing.colorchooser.ColorSelectionModel definition code for javax.swing.colorchooser.ColorSelectionModel
Parameters:
l - the ChangeListener to be removed

getChangeListeners sample code for javax.swing.colorchooser.DefaultColorSelectionModel.getChangeListeners() definition code for javax.swing.colorchooser.DefaultColorSelectionModel.getChangeListeners()

public ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener [] getChangeListeners()
Returns an array of all the ChangeListeners added to this DefaultColorSelectionModel with addChangeListener.

Returns:
all of the ChangeListeners added, or an empty array if no listeners have been added
Since:
1.4

fireStateChanged sample code for javax.swing.colorchooser.DefaultColorSelectionModel.fireStateChanged() definition code for javax.swing.colorchooser.DefaultColorSelectionModel.fireStateChanged()

protected void fireStateChanged()
Runs each ChangeListener's stateChanged method.

See Also:
EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList