Class ChooserColorSpecifier
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.config.SpecifierPanel<java.awt.Color>
-
- uk.ac.starlink.ttools.plot2.config.ChooserColorSpecifier
-
- All Implemented Interfaces:
Specifier<java.awt.Color>
public class ChooserColorSpecifier extends SpecifierPanel<java.awt.Color>
SpecifierPanel subclass that uses a JColorChooser to specify a colour. The color chooser is somewhat customised, including by installing a custom Palettes chooser panel, and the whole thing is displayed in a popup menu rather than a dialogue or frame, since that more closely approximates what you get from other SpecifierPanel components (such as a JComboBox).- Since:
- 27 Jan 2017
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description ChooserColorSpecifier(java.awt.Color dfltColor)Constructs a specifier based on a given default colour.ChooserColorSpecifier(javax.swing.JColorChooser chooser)Constructs a specifier based on a given JColorChooser.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.swing.JComponentcreateComponent()Abstract method called lazily duringgetComponentto obtain the graphical component used by this specifier.static java.util.Map<java.lang.String,java.awt.Color[]>createPaletteMap()Creates some standard named colour lists.javax.swing.JColorChoosergetColorChooser()Returns this specifier's JColorChooser.java.awt.ColorgetSpecifiedValue()Returns the typed value currently specified by the graphical component.voidsetSpecifiedValue(java.awt.Color color)Sets the typed value represented by the graphical component.voidsubmitReport(ReportMap report)Accepts information about a completed plot that was drawn with input from this specifier.-
Methods inherited from class uk.ac.starlink.ttools.plot2.config.SpecifierPanel
addActionListener, fireAction, getActionForwarder, getChangeForwarder, getComponent, isXFill, removeActionListener
-
-
-
-
Constructor Detail
-
ChooserColorSpecifier
public ChooserColorSpecifier(java.awt.Color dfltColor)
Constructs a specifier based on a given default colour.- Parameters:
dfltColor- initial colour
-
ChooserColorSpecifier
public ChooserColorSpecifier(javax.swing.JColorChooser chooser)
Constructs a specifier based on a given JColorChooser.- Parameters:
chooser- chooser component
-
-
Method Detail
-
createComponent
protected javax.swing.JComponent createComponent()
Description copied from class:SpecifierPanelAbstract method called lazily duringgetComponentto obtain the graphical component used by this specifier. It will be called a maximum of once. It is not necessary that the component actually be created in this method, for instance it may be created at construction time if that's more convenient.- Specified by:
createComponentin classSpecifierPanel<java.awt.Color>- Returns:
- graphical component
-
getSpecifiedValue
public java.awt.Color getSpecifiedValue()
Description copied from interface:SpecifierReturns the typed value currently specified by the graphical component.- Returns:
- specified value
-
setSpecifiedValue
public void setSpecifiedValue(java.awt.Color color)
Description copied from interface:SpecifierSets the typed value represented by the graphical component. Calling this method ought to make it clear to the user what value it is set at; in any case a subsequent call ofgetSpecifiedValueshould yield the same result.However if a value is set which is of the correct type but cannot be represented by this specifier, results are unpredictable.
- Parameters:
color- new value
-
submitReport
public void submitReport(ReportMap report)
Description copied from interface:SpecifierAccepts information about a completed plot that was drawn with input from this specifier. In many cases, the implementation of this method will be a no-op, but it gives this object a chance to update its state or its component's appearance based on the way the plot was actually drawn, which may provide information not otherwise available to this object.- Parameters:
report- report of a plot partially specified by this object
-
getColorChooser
public javax.swing.JColorChooser getColorChooser()
Returns this specifier's JColorChooser.- Returns:
- color chooser
-
createPaletteMap
public static java.util.Map<java.lang.String,java.awt.Color[]> createPaletteMap()
Creates some standard named colour lists. The sequences of some of these have been somewhat adjusted so that the colours align between different palettes.- Returns:
- paletteName->colourList map
-
-