Class DefaultSwatchChooserPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class DefaultSwatchChooserPanel extends AbstractColorChooserPanel
The standard color swatch chooser, enhanced with remembering recently used swatches.
Author:
Christopher Mindus
See Also:
  • Constructor Details

    • DefaultSwatchChooserPanel

      public DefaultSwatchChooserPanel()
  • Method Details

    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in class AbstractColorChooserPanel
    • getMnemonic

      public int 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");.

      Overrides:
      getMnemonic in class AbstractColorChooserPanel
      Returns:
      KeyEvent.VK constant identifying the mnemonic; <= 0 for no mnemonic
      Since:
      1.4
      See Also:
    • getDisplayedMnemonicIndex

      public int 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");.

      Overrides:
      getDisplayedMnemonicIndex in class AbstractColorChooserPanel
      Returns:
      Character index to render mnemonic for; -1 to provide no visual identifier for this panel.
      Since:
      1.4
      See Also:
    • getSmallDisplayIcon

      public Icon getSmallDisplayIcon()
      Specified by:
      getSmallDisplayIcon in class AbstractColorChooserPanel
    • getLargeDisplayIcon

      public Icon getLargeDisplayIcon()
      Specified by:
      getLargeDisplayIcon in class AbstractColorChooserPanel
    • installChooserPanel

      public void installChooserPanel(JColorChooser enclosingChooser)
      The background color, foreground color, and font are already set to the defaults from the defaults table before this method is called.
      Overrides:
      installChooserPanel in class AbstractColorChooserPanel
    • buildChooser

      protected void buildChooser()
      Specified by:
      buildChooser in class AbstractColorChooserPanel
    • uninstallChooserPanel

      public void uninstallChooserPanel(JColorChooser enclosingChooser)
      Overrides:
      uninstallChooserPanel in class AbstractColorChooserPanel
    • updateChooser

      public void updateChooser()
      Specified by:
      updateChooser in class AbstractColorChooserPanel