- 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 interfaceA 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 Control.BuilderactionControlBuilder(Control.ActionCommand actionCommand) Creates a new Builder.static Control.Builderbuilder(Control.Command command) Creates a new Builder.static Controlcontrol(Control.Command command) Creates a control based on aControl.Commandis.codion.common.state.StateObserverenabled()static ControleventControl(is.codion.common.event.Event<ActionEvent> event) Creates a Control which triggers the given event on action performedstatic Control.BuildereventControlBuilder(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:
-
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
Creates a new Builder.- Parameters:
command- the command to base the control on- Returns:
- a new Control.Builder
-
actionControlBuilder
Creates a new Builder.- Parameters:
actionCommand- the action command to base the control on- Returns:
- a new Control.Builder
-
eventControlBuilder
Creates a Builder for a control which triggers the given event on action performed- Parameters:
event- the event- Returns:
- a new Control.Builder
-