public interface Control extends Action
Modifier and Type | Interface and Description |
---|---|
static interface |
Control.ActionCommand
A command interface, allowing Controls based on
ActionEvent s. |
static interface |
Control.Builder
A builder for Control
|
static interface |
Control.Command
A command interface, allowing Controls based on method references
|
Modifier and Type | Field and Description |
---|---|
static String |
BACKGROUND
The key used for storing the background color.
|
static String |
FONT
The key used for storing the Font.
|
static String |
FOREGROUND
The key used for storing the foreground color.
|
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
Modifier and Type | Method and Description |
---|---|
static Control |
actionControl(Control.ActionCommand actionCommand)
Creates a control based on a
Control.ActionCommand |
static Control.Builder |
actionControlBuilder(Control.ActionCommand actionCommand)
Creates a new Builder.
|
static Control.Builder |
builder(Control.Command command)
Creates a new Builder.
|
static Control |
control(Control.Command command)
Creates a control based on a
Control.Command |
JButton |
createButton()
Creates a button based on this Control
|
JMenuItem |
createMenuItem()
Creates a menu item based on this Control
|
StateObserver |
enabledObserver() |
static Control |
eventControl(Event<ActionEvent> event)
Creates a Control which triggers the given event on action performed
|
static Control.Builder |
eventControlBuilder(Event<ActionEvent> event)
Creates a Builder for a control which triggers the given event on action performed
|
Color |
getBackground() |
String |
getCaption() |
String |
getDescription() |
Font |
getFont() |
Color |
getForeground() |
KeyStroke |
getKeyStroke() |
Icon |
getLargeIcon() |
int |
getMnemonic() |
Icon |
getSmallIcon() |
Control |
setBackground(Color background) |
Control |
setCaption(String caption) |
Control |
setDescription(String description) |
void |
setEnabled(boolean enabled)
Unsupported, the enabled state of Controls is based on their
enabledState |
Control |
setFont(Font font) |
Control |
setForeground(Color foreground) |
Control |
setKeyStroke(KeyStroke keyStroke) |
Control |
setLargeIcon(Icon largeIcon) |
Control |
setMnemonic(int mnemonic) |
Control |
setSmallIcon(Icon smallIcon) |
addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListener
actionPerformed
static final String FONT
static final String BACKGROUND
static final String FOREGROUND
Control setDescription(String description)
description
- the description stringString getDescription()
String getCaption()
Control setCaption(String caption)
caption
- the caption for this Control instanceStateObserver enabledObserver()
Control setMnemonic(int mnemonic)
mnemonic
- the mnemonic to associate with this Control instanceint getMnemonic()
Control setKeyStroke(KeyStroke keyStroke)
keyStroke
- the KeyStroke to associate with this ControlKeyStroke getKeyStroke()
Control setSmallIcon(Icon smallIcon)
smallIcon
- the small icon to associate with this ControlIcon getSmallIcon()
Control setLargeIcon(Icon largeIcon)
largeIcon
- the large icon to associate with this ControlIcon getLargeIcon()
Control setBackground(Color background)
background
- the background colorColor getBackground()
Control setForeground(Color foreground)
foreground
- the foreground colorColor getForeground()
Font getFont()
JButton createButton()
JMenuItem createMenuItem()
void setEnabled(boolean enabled)
enabledState
setEnabled
in interface Action
enabled
- the enabled statusUnsupportedOperationException
- alwaysControl.Builder.enabledState(StateObserver)
static Control control(Control.Command command)
Control.Command
command
- the Control.Command
on which to base the controlControl.Command
static Control actionControl(Control.ActionCommand actionCommand)
Control.ActionCommand
actionCommand
- the Control.ActionCommand
on which to base the controlControl.Command
static Control eventControl(Event<ActionEvent> event)
event
- the eventstatic Control.Builder builder(Control.Command command)
command
- the command to base the control onstatic Control.Builder actionControlBuilder(Control.ActionCommand actionCommand)
actionCommand
- the action command to base the control onstatic Control.Builder eventControlBuilder(Event<ActionEvent> event)
event
- the event