Package jmri.util.swing
Class JmriColorChooser
java.lang.Object
jmri.util.swing.JmriColorChooser
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddRecentColor(Color color) Add a new color to the recent list.static JColorChooserextendColorChooser(JColorChooser chooser) Add or replace the JMRI custom panel at the beginning of the chooser tabsProvide a copy of the recent color list.static ColorshowDialog(Component comp, String dialogTitle, Color currentColor) Display the customized color selection dialog.static voidsuppressAddRecentColor(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.
-
Field Details
-
color
The number of tabs in the color chooser, 5 standard plus the custom JMRI tab
-
-
Constructor Details
-
JmriColorChooser
public JmriColorChooser()
-
-
Method Details
-
addRecentColor
Add a new color to the recent list. Null values and duplicates are not added.- Parameters:
color- The color object to be added.
-
suppressAddRecentColor
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
Provide a copy of the recent color list. This is used byJmriColorChooserPanelto build the recent color list.- Returns:
- the recent color list.
-
showDialog
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
-