Class ColorsConfigItem

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class ColorsConfigItem extends JPanel
GUI element that allows easy color selection
See Also:
  • Field Details

    • colorCurrent

      protected Color colorCurrent
    • text

      protected final String text
  • Constructor Details

    • ColorsConfigItem

      public ColorsConfigItem(Color currentColor, Color defaultColor, Consumer<Color> colorChangedListener)
      Creates color configuration UI component, similar to the ones Bookmap uses. No label is used (equivalent of ColorsConfigItem(Color, Color, String, Consumer) with label set to null}
      Parameters:
      currentColor - currently selected color (component will be set to it)
      defaultColor - default color (when reset button is pressed it will be applied)
      colorChangedListener - called when color is changed (regardless of the way it happens - reset also counts as color change)
    • ColorsConfigItem

      public ColorsConfigItem(Color currentColor, Color defaultColor, String label, Consumer<Color> colorChangedListener)
      Creates color configuration UI component, similar to the ones Bookmap uses
      Parameters:
      currentColor - currently selected color (component will be set to it)
      defaultColor - default color (when reset button is pressed it will be applied)
      label - text on the component, null to remove label
      colorChangedListener - called when color is changed (regardless of the way it happens - reset also counts as color change)
    • ColorsConfigItem

      public ColorsConfigItem(String fullName, String text, boolean showLabel, Color defaultColor, IndicatorColorInterface indicatorColorInterface, ColorsChangedListener listener)
      Parameters:
      fullName - full color name
      text - text that may be displayed to user
      showLabel - false if text should not be displayed, true otherwise
      defaultColor - if no color is already in settings for this name, this color will be used. Restoring default will use this color.
      listener -
    • ColorsConfigItem

      public ColorsConfigItem(String fullName, String text, boolean showLabel, Color defaultColor, IndicatorColorInterface indicatorColorInterface, ColorsChangedListener listener, velox.gui.colors.ColorsConfigItemCallbacks callbacks, boolean styleAsMenuItem)
      Parameters:
      fullName - full color name
      text - text that may be displayed to user
      showLabel - false if text should not be displayed, true otherwise
      defaultColor - if no color is already in settings for this name, this color will be used. Restoring default will use this color.
      listener -
      callbacks - may be null
      styleAsMenuItem - if true, item will be styled to put in menu
    • ColorsConfigItem

      public ColorsConfigItem(String fullName, String text, Color defaultColor, IndicatorColorInterface indicatorColorInterface, ColorsChangedListener listener)
      Parameters:
      fullName -
      text - can be null if no label
      defaultColor - if no color is already in settings for this name, this color will be used. Restoring default will use this color.
      indicatorColorInterface -
      listener -
    • ColorsConfigItem

      public ColorsConfigItem(String text, Color defaultColor, IndicatorColorInterface indicatorColorInterface, ColorsChangedListener listener)
    • ColorsConfigItem

      public ColorsConfigItem(String fullName, String text, boolean showLabel, Color defaultColor, IndicatorColorInterface indicatorColorInterface, ColorsChangedListener listener, velox.gui.colors.ColorsConfigItemCallbacks callbacks, boolean styleAsMenuItem, Insets insets)
      Parameters:
      fullName - full color name
      text - text that may be displayed to user
      showLabel - false if text should not be displayed, true otherwise
      defaultColor - if no color is already in settings for this name, this color will be used. Restoring default will use this color.
      listener -
      callbacks - may be null
      styleAsMenuItem - if true, item will be styled to put in menu
    • ColorsConfigItem

      public ColorsConfigItem(String fullName, String text, boolean showLabel, Color defaultColor, IndicatorColorInterface indicatorColorInterface, ColorsChangedListener listener, velox.gui.colors.ColorsConfigItemCallbacks callbacks, ColorsConfigItem.GuiConfig guiConfig)
  • Method Details

    • getColorConfigName

      public String getColorConfigName()
    • getColor

      public Color getColor()
    • setColor

      public void setColor(Color color, boolean call)
    • onCurrentColorChanged

      public void onCurrentColorChanged()
    • onAdjust

      protected void onAdjust()
    • onRestore

      public void onRestore(boolean call)
    • getLabel

      public JLabel getLabel()
    • setEnabled

      public void setEnabled(boolean enabled)
      Overrides:
      setEnabled in class JComponent
    • updateColor

      public void updateColor()
      Sets current color to match color provided by color interface (to be used in case color was changed externally)