Class JmriColorChooser

java.lang.Object
jmri.util.swing.JmriColorChooser

public class JmriColorChooser extends Object
Display the Java color chooser that includes a custom JMRI panel. The custom panel is provided by JmriColorChooserPanel.

Maintain a list of recently used colors. This includes colors found during loading and subsequent changes.

Since:
4.13.1
  • Field Details

    • color

      static Color color
      The number of tabs in the color chooser, 5 standard plus the custom JMRI tab
  • Constructor Details

  • Method Details

    • addRecentColor

      public static void addRecentColor(Color color)
      Add a new color to the recent list. Null values and duplicates are not added.
      Parameters:
      color - The color object to be added.
    • suppressAddRecentColor

      public static void suppressAddRecentColor(boolean set)
      Suppress adding colors while temporarily displaying colors to wysiwyg applications of JmriColorChooser - e.g. use of RGB tab while editing colors on CPE panels.
      Parameters:
      set - if true, previewed color is not added.
    • getRecentColors

      public static ArrayList<Color> getRecentColors()
      Provide a copy of the recent color list. This is used by JmriColorChooserPanel to build the recent color list.
      Returns:
      the recent color list.
    • showDialog

      public static Color showDialog(Component comp, String dialogTitle, Color currentColor)
      Display the customized color selection dialog. The JMRI custom panel is added before the Java supplied panels so that it will be the default panel.
      Parameters:
      comp - The calling component. It is not used but provided to simplify migration.
      dialogTitle - The title at the top of the dialog.
      currentColor - The color that will be set as the starting value for the dialog.
      Returns:
      the selected color for a OK response, the orignal color for a Cancel response.
    • extendColorChooser

      Add or replace the JMRI custom panel at the beginning of the chooser tabs
      Parameters:
      chooser - The chooser object to be updated.
      Returns:
      the updated chooser object