|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JColorChooser
JColorChooser provides a pane of controls designed to allow a user to manipulate and select a color. This class provides 3 levels of API:
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.
Inner Class Summary | |
protected class |
JColorChooser.AccessibleJColorChooser
The class used to obtain the accessible context for this object. |
Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Field Summary | |
protected AccessibleContext |
accessibleContext
|
static String |
CHOOSER_PANELS_PROPERTY
The chooserPanel array property name. |
static String |
PREVIEW_PANEL_PROPERTY
The preview panel property name. |
static String |
SELECTION_MODEL_PROPERTY
The selection model property name. |
Fields inherited from class javax.swing.JComponent |
accessibleContext,
listenerList,
TOOL_TIP_TEXT_KEY,
ui,
UNDEFINED_CONDITION,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
WHEN_FOCUSED,
WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
JColorChooser()
Creates a color chooser pane with an initial color of white. |
|
JColorChooser(Color initialColor)
Creates a color chooser pane with the specified initial color. |
|
JColorChooser(ColorSelectionModel model)
Creates a color chooser pane with the specified ColorSelectionModel. |
Method Summary | |
void |
addChooserPanel(AbstractColorChooserPanel panel)
Adds a color chooser panel to the color chooser. |
static JDialog |
createDialog(Component c,
String title,
boolean modal,
JColorChooser chooserPane,
ActionListener okListener,
ActionListener cancelListener)
Creates and returns a new dialog containing the specified ColorChooser pane along with "OK", "Cancel", and "Reset" buttons. |
AccessibleContext |
getAccessibleContext()
Get the AccessibleContext associated with this JColorChooser |
AbstractColorChooserPanel[] |
getChooserPanels()
Returns the specified color panels. |
Color |
getColor()
Gets the current color value from the color chooser. |
JComponent |
getPreviewPanel()
Returns the preview panel that shows a chosen color. |
ColorSelectionModel |
getSelectionModel()
Returns the data model that handles color selections. |
ColorChooserUI |
getUI()
Returns the L&F object that renders this component. |
String |
getUIClassID()
Returns the name of the L&F class that renders this component. |
protected String |
paramString()
Returns a string representation of this JColorChooser. |
AbstractColorChooserPanel |
removeChooserPanel(AbstractColorChooserPanel panel)
Removes the Color Panel specified. |
void |
setChooserPanels(AbstractColorChooserPanel[] panels)
Specifies the Color Panels used to choose a color value. |
void |
setColor(Color color)
Sets the current color of the color chooser to the specified color. |
void |
setColor(int c)
Sets the current color of the color chooser to the specified color. |
void |
setColor(int r,
int g,
int b)
Sets the current color of the color chooser to the specified RGB color. |
void |
setPreviewPanel(JComponent preview)
Sets the current preview panel. |
void |
setSelectionModel(ColorSelectionModel newModel)
Set the model containing the selected color. |
void |
setUI(ColorChooserUI ui)
Sets the L&F object that renders this component. |
static Color |
showDialog(Component component,
String title,
Color initialColor)
Shows a modal color-chooser dialog and blocks until the dialog is hidden. |
void |
updateUI()
Notification from the UIManager that the L&F has changed. |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getLayout,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
preferredSize,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
setLayout,
validate,
validateTree |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final String SELECTION_MODEL_PROPERTY
public static final String PREVIEW_PANEL_PROPERTY
public static final String CHOOSER_PANELS_PROPERTY
protected AccessibleContext accessibleContext
Constructor Detail |
public JColorChooser()
public JColorChooser(Color initialColor)
initialColor
- the initial color set in the chooserpublic JColorChooser(ColorSelectionModel model)
initialColor
- the initial color set in the chooserMethod Detail |
public static Color showDialog(Component component, String title, Color initialColor)
component
- the parent Component for the dialogtitle
- the String containing the dialog's titleinitialColor
- the initial Color set when the color-chooser is shownpublic static JDialog createDialog(Component c, String title, boolean modal, JColorChooser chooserPane, ActionListener okListener, ActionListener cancelListener)
c
- the parent component for the dialogtitle
- the title for the dialogmodal
- a boolean. When true, the remainder of the program
is inactive until the dialog is closed.chooserPane
- the color-chooser to be placed inside the dialogokListener
- the ActionListener invoked when "OK" is pressedcancelListener
- the ActionListener invoked when "Cancel" is pressedpublic ColorChooserUI getUI()
public void setUI(ColorChooserUI ui)
ui
- the ColorChooserUI L&F objectUIDefaults.getUI(javax.swing.JComponent)
public void updateUI()
JComponent.updateUI()
public String getUIClassID()
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
public Color getColor()
public void setColor(Color color)
color
- the color to be set in the color chooserJComponent.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void setColor(int r, int g, int b)
r
- an int specifying the amount of Redg
- an int specifying the amount of Greenb
- an int specifying the amount of Bluepublic void setColor(int c)
c
- an int value that sets the current color in the chooser
where the low-order 8 bits specify the Blue value,
the next 8 bits specify the Green value, and the 8 bits
above that specify the Red value.public void setPreviewPanel(JComponent preview)
color
- the color to be set in the color chooserJComponent.addPropertyChangeListener(java.beans.PropertyChangeListener)
public JComponent getPreviewPanel()
public void addChooserPanel(AbstractColorChooserPanel panel)
public AbstractColorChooserPanel removeChooserPanel(AbstractColorChooserPanel panel)
name
- a string that specifies the panel to be removedpublic void setChooserPanels(AbstractColorChooserPanel[] panels)
panels
- an array of AbstractColorChooserPanel objectpublic AbstractColorChooserPanel[] getChooserPanels()
public ColorSelectionModel getSelectionModel()
public void setSelectionModel(ColorSelectionModel newModel)
newModel
- the new ColorSelectionModel objectprotected String paramString()
null
.
Overriding paramString() to provide information about the specific new aspects of the JFC components.
public AccessibleContext getAccessibleContext()
|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |