- All Superinterfaces:
Action
,ActionListener
,EventListener
- All Known Subinterfaces:
Controls
,ToggleControl
A beefed up Action.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
A command interface, allowing Controls based onActionEvent
s.static interface
Control.Builder<C extends Control,
B extends Control.Builder<C, B>> A builder for Controlstatic interface
A command interface, allowing Controls based on method references -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The key used for storing the background color.static final String
The key used for storing the Font.static final String
The 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 Control
actionControl
(Control.ActionCommand actionCommand) Creates a control based on aControl.ActionCommand
static <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 Control
control
(Control.Command command) Creates a control based on aControl.Command
<B extends Control.Builder<Control,
B>>
Control.Builder<Control,B> copy
(Event<ActionEvent> event) Returns aControl.Builder
instance, 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.Builder
instance, 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.Builder
instance, based on a copy of this control, using the given command.enabled()
static Control
eventControl
(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
(Event<ActionEvent> event) Creates a Builder for a control which triggers the given event on action performedgetFont()
int
getName()
void
setBackground
(Color background) void
setDescription
(String description) void
setEnabled
(boolean enabled) Unsupported, the enabled state of Controls is based on theirenabled
state observervoid
void
setForeground
(Color foreground) void
setKeyStroke
(KeyStroke keyStroke) void
setLargeIcon
(Icon largeIcon) void
setMnemonic
(int mnemonic) void
void
setSmallIcon
(Icon smallIcon) Methods inherited from interface javax.swing.Action
accept, addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListener
Methods 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
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 theirenabled
state observer- Specified by:
setEnabled
in interfaceAction
- Parameters:
enabled
- the enabled status- Throws:
UnsupportedOperationException
- always- See Also:
-
copy
Returns aControl.Builder
instance, 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.Builder
instance, 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
Returns aControl.Builder
instance, 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.Command
on 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.ActionCommand
on 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(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
-