APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javax.swing.colorchooser

pack-priv Class DefaultSwatchChooserPanel

Additional top-level classes in compilation unit: SwatchPanel, RecentSwatchPanel, MainSwatchPanel.

extends AbstractColorChooserPanel
Class Inheritance
Annotations
@SuppressWarnings:serial
Imports
javax.swing.*, javax.swing.border.*, javax.swing.event.*, java.awt.*, java.awt.image.*, java.awt.event.*, java.beans.PropertyChangeEvent, .PropertyChangeListener, java.io.Serializable, javax.accessibility.*

The standard color swatch chooser.

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. As of 1.4, support for long term storage of all JavaBeans has been added to the java.beans package. Please see java.beans.XMLEncoder.

Author
Steve Wilson

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
pack-priv class
private class
pack-priv class

Field Summary

Modifier and TypeField and Description
private KeyListener
pack-priv MouseListener
private KeyListener
pack-priv MouseListener
pack-priv RecentSwatchPanel
pack-priv SwatchPanel
Inherited from javax.swing.colorchooser.AbstractColorChooserPanel:
TRANSPARENCY_ENABLED_PROPERTY

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
buildChooser()

Implements abstract javax.swing.colorchooser.AbstractColorChooserPanel.buildChooser.

Builds a new chooser panel.

public int

Returns:

Character index to render mnemonic for; -1 to provide no visual identifier for this panel.
getDisplayedMnemonicIndex
()

Overrides javax.swing.colorchooser.AbstractColorChooserPanel.getDisplayedMnemonicIndex.

Provides a hint to the look and feel as to the index of the character in getDisplayName that should be visually identified as the mnemonic.

public String
getDisplayName()

Implements abstract javax.swing.colorchooser.AbstractColorChooserPanel.getDisplayName.

Returns a string containing the display name of the panel.

public Icon
getLargeDisplayIcon()

Implements abstract javax.swing.colorchooser.AbstractColorChooserPanel.getLargeDisplayIcon.

Returns the large display icon for the panel.

public int

Returns:

KeyEvent.VK constant identifying the mnemonic; <= 0 for no mnemonic
getMnemonic
()

Overrides javax.swing.colorchooser.AbstractColorChooserPanel.getMnemonic.

Provides a hint to the look and feel as to the KeyEvent.VK constant that can be used as a mnemonic to access the panel.

public Icon
getSmallDisplayIcon()

Implements abstract javax.swing.colorchooser.AbstractColorChooserPanel.getSmallDisplayIcon.

Returns the small display icon for the panel.

public void
installChooserPanel(JColorChooser enclosingChooser)

Overrides javax.swing.colorchooser.AbstractColorChooserPanel.installChooserPanel.

The background color, foreground color, and font are already set to the defaults from the defaults table before this method is called.

public void
uninstallChooserPanel(JColorChooser enclosingChooser)

Overrides javax.swing.colorchooser.AbstractColorChooserPanel.uninstallChooserPanel.

Invoked when the panel is removed from the chooser.

public void
updateChooser()

Implements abstract javax.swing.colorchooser.AbstractColorChooserPanel.updateChooser.

Invoked automatically when the model's state changes.

Inherited from javax.swing.colorchooser.AbstractColorChooserPanel:
getColorFromModelgetColorSelectionModelgetIntisColorTransparencySelectionEnabledpaintsetColorTransparencySelectionEnabledsetSelectedColor

Field Detail

mainSwatchKeyListenerback to summary
private KeyListener mainSwatchKeyListener
mainSwatchListenerback to summary
pack-priv MouseListener mainSwatchListener
recentSwatchKeyListenerback to summary
private KeyListener recentSwatchKeyListener
recentSwatchListenerback to summary
pack-priv MouseListener recentSwatchListener
recentSwatchPanelback to summary
pack-priv RecentSwatchPanel recentSwatchPanel
swatchPanelback to summary
pack-priv SwatchPanel swatchPanel

Constructor Detail

DefaultSwatchChooserPanelback to summary
public DefaultSwatchChooserPanel()

Method Detail

buildChooserback to summary
protected void buildChooser()

Implements abstract javax.swing.colorchooser.AbstractColorChooserPanel.buildChooser.

Doc from javax.swing.colorchooser.AbstractColorChooserPanel.buildChooser.

Builds a new chooser panel.

getDisplayedMnemonicIndexback to summary
public int getDisplayedMnemonicIndex()

Overrides javax.swing.colorchooser.AbstractColorChooserPanel.getDisplayedMnemonicIndex.

Provides a hint to the look and feel as to the index of the character in getDisplayName that should be visually identified as the mnemonic. The look and feel should only use this if getMnemonic returns a value > 0.

The return value here is a hint, it is ultimately up to the look and feel to honor the return value in some meaningful way. For example, a look and feel may wish to render each AbstractColorChooserPanel in a JTabbedPane, and further use this return value to underline a character in the getDisplayName.

This implementation looks up the value from the default ColorChooser.rgbDisplayedMnemonicIndex, or if it isn't available (or not an Integer) returns -1. The lookup for the default is done through the UIManager: UIManager.get("ColorChooser.swatchesDisplayedMnemonicIndex");.

Returns:int

Character index to render mnemonic for; -1 to provide no visual identifier for this panel.

Since
1.4
See Also
getMnemonic
getDisplayNameback to summary
public String getDisplayName()

Implements abstract javax.swing.colorchooser.AbstractColorChooserPanel.getDisplayName.

Doc from javax.swing.colorchooser.AbstractColorChooserPanel.getDisplayName.

Returns a string containing the display name of the panel.

getLargeDisplayIconback to summary
public Icon getLargeDisplayIcon()

Implements abstract javax.swing.colorchooser.AbstractColorChooserPanel.getLargeDisplayIcon.

Doc from javax.swing.colorchooser.AbstractColorChooserPanel.getLargeDisplayIcon.

Returns the large display icon for the panel.

getMnemonicback to summary
public int getMnemonic()

Overrides javax.swing.colorchooser.AbstractColorChooserPanel.getMnemonic.

Provides a hint to the look and feel as to the KeyEvent.VK constant that can be used as a mnemonic to access the panel. A return value <= 0 indicates there is no mnemonic.

The return value here is a hint, it is ultimately up to the look and feel to honor the return value in some meaningful way.

This implementation looks up the value from the default ColorChooser.swatchesMnemonic, or if it isn't available (or not an Integer) returns -1. The lookup for the default is done through the UIManager: UIManager.get("ColorChooser.swatchesMnemonic");.

Returns:int

KeyEvent.VK constant identifying the mnemonic; <= 0 for no mnemonic

Since
1.4
See Also
getDisplayedMnemonicIndex
getSmallDisplayIconback to summary
public Icon getSmallDisplayIcon()

Implements abstract javax.swing.colorchooser.AbstractColorChooserPanel.getSmallDisplayIcon.

Doc from javax.swing.colorchooser.AbstractColorChooserPanel.getSmallDisplayIcon.

Returns the small display icon for the panel.

installChooserPanelback to summary
public void installChooserPanel(JColorChooser enclosingChooser)

Overrides javax.swing.colorchooser.AbstractColorChooserPanel.installChooserPanel.

The background color, foreground color, and font are already set to the defaults from the defaults table before this method is called.

uninstallChooserPanelback to summary
public void uninstallChooserPanel(JColorChooser enclosingChooser)

Overrides javax.swing.colorchooser.AbstractColorChooserPanel.uninstallChooserPanel.

Doc from javax.swing.colorchooser.AbstractColorChooserPanel.uninstallChooserPanel.

Invoked when the panel is removed from the chooser. If override this, be sure to call super.

updateChooserback to summary
public void updateChooser()

Implements abstract javax.swing.colorchooser.AbstractColorChooserPanel.updateChooser.

Doc from javax.swing.colorchooser.AbstractColorChooserPanel.updateChooser.

Invoked automatically when the model's state changes. It is also called by installChooserPanel to allow you to set up the initial state of your chooser. Override this method to update your ChooserPanel.

javax.swing.colorchooser back to summary

private Class DefaultSwatchChooserPanel.MainSwatchKeyListener

extends KeyAdapter
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
keyPressed(KeyEvent e)

Overrides java.awt.event.KeyAdapter.keyPressed.

Implements java.awt.event.KeyListener.keyPressed.

Invoked when a key has been pressed.

Inherited from java.awt.event.KeyAdapter:
keyReleasedkeyTyped

Constructor Detail

MainSwatchKeyListenerback to summary
private MainSwatchKeyListener()

Method Detail

keyPressedback to summary
public void keyPressed(KeyEvent e)

Overrides java.awt.event.KeyAdapter.keyPressed.

Implements java.awt.event.KeyListener.keyPressed.

Doc from java.awt.event.KeyAdapter.keyPressed.

Invoked when a key has been pressed.

javax.swing.colorchooser back to summary

pack-priv Class DefaultSwatchChooserPanel.MainSwatchListener

extends MouseAdapter
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
mousePressed(MouseEvent e)

Overrides java.awt.event.MouseAdapter.mousePressed.

Implements java.awt.event.MouseListener.mousePressed.

Invoked when a mouse button has been pressed on a component.

Inherited from java.awt.event.MouseAdapter:
mouseClickedmouseDraggedmouseEnteredmouseExitedmouseMovedmouseReleasedmouseWheelMoved

Constructor Detail

MainSwatchListenerback to summary
pack-priv MainSwatchListener()

Method Detail

mousePressedback to summary
public void mousePressed(MouseEvent e)

Overrides java.awt.event.MouseAdapter.mousePressed.

Implements java.awt.event.MouseListener.mousePressed.

Doc from java.awt.event.MouseAdapter.mousePressed.

Invoked when a mouse button has been pressed on a component.

javax.swing.colorchooser back to summary

private Class DefaultSwatchChooserPanel.RecentSwatchKeyListener

extends KeyAdapter
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
keyPressed(KeyEvent e)

Overrides java.awt.event.KeyAdapter.keyPressed.

Implements java.awt.event.KeyListener.keyPressed.

Invoked when a key has been pressed.

Inherited from java.awt.event.KeyAdapter:
keyReleasedkeyTyped

Constructor Detail

RecentSwatchKeyListenerback to summary
private RecentSwatchKeyListener()

Method Detail

keyPressedback to summary
public void keyPressed(KeyEvent e)

Overrides java.awt.event.KeyAdapter.keyPressed.

Implements java.awt.event.KeyListener.keyPressed.

Doc from java.awt.event.KeyAdapter.keyPressed.

Invoked when a key has been pressed.

javax.swing.colorchooser back to summary

pack-priv Class DefaultSwatchChooserPanel.RecentSwatchListener

extends MouseAdapter
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
mousePressed(MouseEvent e)

Overrides java.awt.event.MouseAdapter.mousePressed.

Implements java.awt.event.MouseListener.mousePressed.

Invoked when a mouse button has been pressed on a component.

Inherited from java.awt.event.MouseAdapter:
mouseClickedmouseDraggedmouseEnteredmouseExitedmouseMovedmouseReleasedmouseWheelMoved

Constructor Detail

RecentSwatchListenerback to summary
pack-priv RecentSwatchListener()

Method Detail

mousePressedback to summary
public void mousePressed(MouseEvent e)

Overrides java.awt.event.MouseAdapter.mousePressed.

Implements java.awt.event.MouseListener.mousePressed.

Doc from java.awt.event.MouseAdapter.mousePressed.

Invoked when a mouse button has been pressed on a component.