Class ColorChooserPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class ColorChooserPanel extends JPanel
A custom Colour Scheme Browser - custom choices based on JColorChooser.
See Also:
  • Constructor Details

    • ColorChooserPanel

      public ColorChooserPanel()
    • ColorChooserPanel

      public ColorChooserPanel(boolean withTransparencySlider)
      Constructor method
      Parameters:
      withTransparencySlider - boolean that specifies if the user wants a slider with the color chooser panel to control the transparency of the selected color.Also, it will appear a text which specifies the transparency percentage.
      withNoFill - boolean that specifies if the color chooser panel allows a null value for the color selected (true case). If this values is false, when the color selected is null then black color is assigned automatically.
    • ColorChooserPanel

      public ColorChooserPanel(boolean withTransparencySlider, boolean withNoFill)
      Constructor method
      Parameters:
      withTransparencySlider - boolean that specifies if the user wants a slider with the color chooser panel to control the transparency of the selected color.
      withNoFill - boolean that specifies if the color chooser panel allows a null value for the color selected (true case). If this values is false, when the color selected is null then black color is assigned automatically.
  • Method Details

    • getUseColorisSelected

      public boolean getUseColorisSelected()
      Returns true if the check box of the color chooser panel is selected. False otherwise.
      Returns:
      boolean true if the check box is selected. Otherwise, false.
    • setUseColorIsSelected

      public void setUseColorIsSelected(boolean b)
      Sets the check box of the color chooser panel
      Parameters:
      b - boolean true if the user wants to select it.Otherwise, false.
    • addActionListener

      public void addActionListener(ActionListener l)
    • removeActionListener

      public void removeActionListener(ActionListener l)
    • fireActionPerformed

      protected void fireActionPerformed()
    • setColor

      public void setColor(Color color)
      Sets the color of the chooser panel.
      Parameters:
      color - Color to be selected.
    • setAlpha

      public void setAlpha(int alpha)
      Sets the alpha value of the color selected in the color chooser panel.
      Parameters:
      alpha - Alpha value of the color.
    • getAlpha

      public int getAlpha()
    • getColor

      public Color getColor()
      Obtains the selected color in the color chooser panel.
      Returns:
      color the selected color
    • disabledWithTransparency

      public void disabledWithTransparency()
    • setEnabled

      public void setEnabled(boolean newEnabled)
      Overrides:
      setEnabled in class JComponent
    • main

      public static void main(String[] args)