Class ColorButton

All Implemented Interfaces:
ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, SwingConstants

public class ColorButton extends JButton
Swing button that displays and edits one color value.
See Also:
  • Constructor Details

    • ColorButton

      public ColorButton(String text, Color initialColor)
      Creates a color button instance.
      Parameters:
      text - text to display or edit
      initialColor - color value to use
    • ColorButton

      public ColorButton(String text, Color initialColor, Consumer<Color> cb)
      Creates a color button instance.
      Parameters:
      text - text to display or edit
      initialColor - color value to use
      cb - cb value used by the operation
  • Method Details

    • getSelectedColor

      public Color getSelectedColor()
      Returns the selected color.
      Returns:
      the selected color
    • setSelectedColor

      public void setSelectedColor(Color selectedColor)
      Sets the selected color.
      Parameters:
      selectedColor - color value to use
    • toString

      public String toString()
      Builds a debug string for this color button.
      Overrides:
      toString in class Component
      Returns:
      a debug string for this object