Class GuiUtils.ColorSwatch

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Enclosing class:
GuiUtils

public static class GuiUtils.ColorSwatch extends JPanel
A color swatch panel
Version:
$Revision: 1.317 $
Author:
IDV Development Team
See Also:
  • Constructor Details

    • ColorSwatch

      public ColorSwatch(Color c, String dialogLabel)
      Create a new ColorSwatch for the specified color
      Parameters:
      c - Color
      dialogLabel - label for the dialog
    • ColorSwatch

      public ColorSwatch(Color c, String dialogLabel, boolean alphaOk)
      Create a new color swatch
      Parameters:
      c - the color
      dialogLabel - label for the dialog
      alphaOk - use alpha?
  • Method Details

    • getSetButton

      public JButton getSetButton()
      Get the set button
      Returns:
      the set button
    • getClearButton

      public JButton getClearButton()
      Get the clear button
      Returns:
      the clear button
    • getSwatchColor

      public Color getSwatchColor()
      Get the Color of the swatch
      Returns:
      the swatch color
    • userSelectedNewColor

      public void userSelectedNewColor(Color c)
      the user chose a new color. Set the background. THis can be overwritted by client code to act on the color change
      Parameters:
      c - color
    • setBackground

      public void setBackground(Color c)
      Set the background to the color
      Overrides:
      setBackground in class JComponent
      Parameters:
      c - Color for background
    • paint

      public void paint(Graphics g)
      Paint this swatch
      Overrides:
      paint in class JComponent
      Parameters:
      g - graphics
    • getPanel

      public JComponent getPanel()
      Get the panel
      Returns:
      the panel
    • getColor

      public Color getColor()
      _more_
      Returns:
      _more_
    • getSetPanel

      public JComponent getSetPanel()
      Get the panel that shows the swatch and the Set button.
      Returns:
      the panel
    • popupNameMenu

      public void popupNameMenu(JButton popupBtn)
      Popup the named list menu
      Parameters:
      popupBtn - Popup near this button
    • setColorName

      public void setColorName(String name)
      Set the color based on name
      Parameters:
      name - color name