Package com.nomagic.actions
Class ColorChooseAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- com.nomagic.actions.NMAction
-
- com.nomagic.actions.ColorChooseAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,java.util.EventListener
,javax.swing.Action
@OpenApi public class ColorChooseAction extends NMAction
Action for choosing a color.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
COLOR
The name or action property 'color'.private java.lang.String
mMoreLabel
Text of 'Select More Colors' label in some UI presentation.private boolean
mNoFillAvailable
Can this action choose 'no fill' property?private java.lang.String
mNoFillLabel
Text of 'No fill' choice label in some UI presentation.private java.awt.Color[]
mRecentColors
Recent colorsstatic java.lang.String
NO_FILL
The name of action property 'no fill'.-
Fields inherited from class com.nomagic.actions.NMAction
ACTION_SHORTCUTS, BELONGS_TO_SEPARATE_GROUP_IN_UI, DO_NO_SHOW_ACTION_NAME_IN_UI, DO_NOT_REGISTER_ACTION_TO_COMPONENTS, GENERATED_ID_PREFIX, GROUP, ID, LARGE_ICON, MENU_SHORTCUT_MASK, TINY_ICON
-
-
Constructor Summary
Constructors Constructor Description ColorChooseAction(java.lang.String moreLabel, java.lang.String noFillLabel, boolean noFillAvailable, java.awt.Color[] recentColors)
Constructs new color action.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
Shows ColorPallet in JPopupMenu when this action is performed.com.nomagic.awt.ColorPallet
createColorPallet()
java.awt.Color
getColor()
Returns color selected by this action.-
Methods inherited from class com.nomagic.actions.NMAction
accept, addAction, addPropertyChangeListener, addShortcut, addShotcut, addWeakPropertyChangeListener, clone, compareTo, createMenuItem, equals, firePropertyChange, forEach, forEachIncludingSelf, getActions, getCommandKey, getDescription, getGroup, getIcon, getID, getLargeIcon, getLargeOrSmallIcon, getMenuShortcutMaskAsString, getMnemonicKey, getName, getPropertyChangeListeners, getShortcuts, getSmallIcon, getSmallOrLargeIcon, getTinyIcon, hashCode, hasMenuShortcutMask, isIDGenerated, removeAction, removeIf, removePropertyChangeListener, removeShortcut, removeWeakPropertyChangeListener, setActions, setDescription, setGroup, setIcon, setLargeIcon, setMnemonicKey, setName, setShortcuts, setSmallIcon, setTinyIcon, shallowClone, toString, updateState
-
Methods inherited from class javax.swing.AbstractAction
getKeys, getValue, isEnabled, putValue, setEnabled
-
-
-
-
Field Detail
-
COLOR
public static final java.lang.String COLOR
The name or action property 'color'.- See Also:
- Constant Field Values
-
NO_FILL
public static final java.lang.String NO_FILL
The name of action property 'no fill'.- See Also:
- Constant Field Values
-
mNoFillAvailable
private final boolean mNoFillAvailable
Can this action choose 'no fill' property?
-
mMoreLabel
private final java.lang.String mMoreLabel
Text of 'Select More Colors' label in some UI presentation.
-
mNoFillLabel
private final java.lang.String mNoFillLabel
Text of 'No fill' choice label in some UI presentation.
-
mRecentColors
private final java.awt.Color[] mRecentColors
Recent colors
-
-
Constructor Detail
-
ColorChooseAction
@OpenApi public ColorChooseAction(java.lang.String moreLabel, java.lang.String noFillLabel, boolean noFillAvailable, java.awt.Color[] recentColors)
Constructs new color action.- Parameters:
moreLabel
- the text of more label.noFillLabel
- the text of no fill label.noFillAvailable
- no fill available or not?
-
-
Method Detail
-
actionPerformed
@OpenApi public void actionPerformed(java.awt.event.ActionEvent e)
Shows ColorPallet in JPopupMenu when this action is performed. For showing popup event source parent is used.- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
- Specified by:
actionPerformed
in classNMAction
- Parameters:
e
- an event caused invocation
-
createColorPallet
public com.nomagic.awt.ColorPallet createColorPallet()
-
getColor
@OpenApi public java.awt.Color getColor()
Returns color selected by this action.- Returns:
- the selected color.
-
-