- All Superinterfaces:
Action,ActionListener,EventListener
- All Known Subinterfaces:
Controls,ToggleControl
A beefed up Action.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA command interface, allowing Controls based onActionEvents.static interfaceControl.Builder<C extends Control,B extends Control.Builder<C, B>> A builder for Controlstatic interfaceA command interface, allowing Controls based on method references -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe key used for storing the background color.static final StringThe key used for storing the Font.static final StringThe key used for storing the foreground color.Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON -
Method Summary
Modifier and TypeMethodDescriptionstatic ControlactionControl(Control.ActionCommand actionCommand) Creates a control based on aControl.ActionCommandstatic <B extends Control.Builder<Control,B>>
Control.Builder<Control,B> actionControlBuilder(Control.ActionCommand actionCommand) Creates a new Builder.static <B extends Control.Builder<Control,B>>
Control.Builder<Control,B> builder(Control.Command command) Creates a new Builder.static Controlcontrol(Control.Command command) Creates a control based on aControl.Command<B extends Control.Builder<Control,B>>
Control.Builder<Control,B> copy(is.codion.common.event.Event<ActionEvent> event) Returns aControl.Builderinstance, based on a copy of this control, using the given command.<B extends Control.Builder<Control,B>>
Control.Builder<Control,B> copy(Control.ActionCommand actionCommand) Returns aControl.Builderinstance, based on a copy of this control, using the given command.<B extends Control.Builder<Control,B>>
Control.Builder<Control,B> copy(Control.Command command) Returns aControl.Builderinstance, based on a copy of this control, using the given command.is.codion.common.state.StateObserverenabled()static ControleventControl(is.codion.common.event.Event<ActionEvent> event) Creates a Control which triggers the given event on action performedstatic <B extends Control.Builder<Control,B>>
Control.Builder<Control,B> eventControlBuilder(is.codion.common.event.Event<ActionEvent> event) Creates a Builder for a control which triggers the given event on action performedgetFont()intgetName()voidsetBackground(Color background) voidsetDescription(String description) voidsetEnabled(boolean enabled) Unsupported, the enabled state of Controls is based on theirenabledstate observervoidvoidsetForeground(Color foreground) voidsetKeyStroke(KeyStroke keyStroke) voidsetLargeIcon(Icon largeIcon) voidsetMnemonic(int mnemonic) voidvoidsetSmallIcon(Icon smallIcon) Methods inherited from interface javax.swing.Action
accept, addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListenerMethods inherited from interface java.awt.event.ActionListener
actionPerformed
-
Field Details
-
FONT
The key used for storing the Font.- See Also:
-
BACKGROUND
The key used for storing the background color.- See Also:
-
FOREGROUND
The key used for storing the foreground color.- See Also:
-
-
Method Details
-
setDescription
- Parameters:
description- the description string
-
getDescription
String getDescription()- Returns:
- the description
-
getName
String getName()- Returns:
- the name
-
setName
- Parameters:
name- the name of this Control
-
enabled
is.codion.common.state.StateObserver enabled()- Returns:
- a StateObsrver indicating whether this Control is enabled
-
setMnemonic
void setMnemonic(int mnemonic) - Parameters:
mnemonic- the mnemonic to associate with this Control
-
getMnemonic
int getMnemonic()- Returns:
- the mnemonic, 0 if none is specified
-
setKeyStroke
- Parameters:
keyStroke- the KeyStroke to associate with this Control
-
getKeyStroke
KeyStroke getKeyStroke()- Returns:
- the KeyStroke associated with this Control, if any
-
setSmallIcon
- Parameters:
smallIcon- the small icon to associate with this Control
-
getSmallIcon
Icon getSmallIcon()- Returns:
- the icon
-
setLargeIcon
- Parameters:
largeIcon- the large icon to associate with this Control
-
getLargeIcon
Icon getLargeIcon()- Returns:
- the icon
-
setBackground
- Parameters:
background- the background color
-
getBackground
Color getBackground()- Returns:
- the background color
-
setForeground
- Parameters:
foreground- the foreground color
-
getForeground
Color getForeground()- Returns:
- the foreground color
-
setFont
- Parameters:
font- the font
-
getFont
Font getFont()- Returns:
- the font
-
setEnabled
void setEnabled(boolean enabled) Unsupported, the enabled state of Controls is based on theirenabledstate observer- Specified by:
setEnabledin interfaceAction- Parameters:
enabled- the enabled status- Throws:
UnsupportedOperationException- always- See Also:
-
copy
Returns aControl.Builderinstance, based on a copy of this control, using the given command.- Type Parameters:
B- the builder type- Parameters:
command- the command for the resulting control- Returns:
- a new builder
-
copy
<B extends Control.Builder<Control,B>> Control.Builder<Control,B> copy(Control.ActionCommand actionCommand) Returns aControl.Builderinstance, based on a copy of this control, using the given command.- Type Parameters:
B- the builder type- Parameters:
actionCommand- the command for the resulting control- Returns:
- a new builder
-
copy
<B extends Control.Builder<Control,B>> Control.Builder<Control,B> copy(is.codion.common.event.Event<ActionEvent> event) Returns aControl.Builderinstance, based on a copy of this control, using the given command.- Type Parameters:
B- the builder type- Parameters:
event- the event for the resulting control to trigger- Returns:
- a new builder
-
control
Creates a control based on aControl.Command- Parameters:
command- theControl.Commandon which to base the control- Returns:
- a Control for calling the given
Control.Command
-
actionControl
Creates a control based on aControl.ActionCommand- Parameters:
actionCommand- theControl.ActionCommandon which to base the control- Returns:
- a Control for calling the given
Control.Command
-
eventControl
Creates a Control which triggers the given event on action performed- Parameters:
event- the event- Returns:
- a control which triggers the given event
-
builder
static <B extends Control.Builder<Control,B>> Control.Builder<Control,B> builder(Control.Command command) Creates a new Builder.- Type Parameters:
B- the builder type- Parameters:
command- the command to base the control on- Returns:
- a new Control.Builder
-
actionControlBuilder
static <B extends Control.Builder<Control,B>> Control.Builder<Control,B> actionControlBuilder(Control.ActionCommand actionCommand) Creates a new Builder.- Type Parameters:
B- the builder type- Parameters:
actionCommand- the action command to base the control on- Returns:
- a new Control.Builder
-
eventControlBuilder
static <B extends Control.Builder<Control,B>> Control.Builder<Control,B> eventControlBuilder(is.codion.common.event.Event<ActionEvent> event) Creates a Builder for a control which triggers the given event on action performed- Type Parameters:
B- the builder type- Parameters:
event- the event- Returns:
- a new Control.Builder
-