Package net.sf.freecol.client.gui.option
Class FreeColActionUI
- java.lang.Object
-
- net.sf.freecol.client.gui.option.OptionUI<FreeColAction>
-
- net.sf.freecol.client.gui.option.FreeColActionUI
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.util.EventListener
,OptionUpdater
public final class FreeColActionUI extends OptionUI<FreeColAction> implements java.awt.event.ActionListener
User interface for displaying/changing a keyboard accelerator for aFreeColAction
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
FreeColActionUI.BlinkingLabel
Label for displaying aKeyStroke
.
-
Field Summary
Fields Modifier and Type Field Description private FreeColActionUI.BlinkingLabel
bl
private javax.swing.KeyStroke
keyStroke
private OptionGroupUI
optionGroupUI
private javax.swing.JPanel
panel
private javax.swing.JButton
recordButton
private javax.swing.JButton
removeButton
-
Constructor Summary
Constructors Constructor Description FreeColActionUI(FreeColAction option, boolean editable)
Creates a newFreeColActionUI
for the givenFreeColAction
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent ae)
javax.swing.JPanel
getComponent()
Get theComponent
used to set the value of the Option.static java.lang.String
getHumanKeyStrokeText(javax.swing.KeyStroke keyStroke)
Gets a string to represent the givenKeyStroke
to the user.static javax.swing.ImageIcon
getRecordImage()
Creates an icon for symbolizing the recording of aKeyStroke
.static javax.swing.ImageIcon
getRemoveImage()
Creates an icon to be used on the button that removes a keyboard accelerator.void
removeKeyStroke(javax.swing.KeyStroke k)
Removes the givenKeyStroke
.void
reset()
Reset the value of the UI's component from the Option.void
setOptionGroupUI(OptionGroupUI ui)
void
updateOption()
Update the value of the Option from the UI's component.-
Methods inherited from class net.sf.freecol.client.gui.option.OptionUI
getJLabel, getListCellRenderer, getOption, getOptionUI, initialize, isEditable, setEditable, setEnabler, setLabel, setOption
-
-
-
-
Field Detail
-
optionGroupUI
private OptionGroupUI optionGroupUI
-
keyStroke
private javax.swing.KeyStroke keyStroke
-
recordButton
private final javax.swing.JButton recordButton
-
removeButton
private final javax.swing.JButton removeButton
-
bl
private final FreeColActionUI.BlinkingLabel bl
-
panel
private final javax.swing.JPanel panel
-
-
Constructor Detail
-
FreeColActionUI
public FreeColActionUI(FreeColAction option, boolean editable)
Creates a newFreeColActionUI
for the givenFreeColAction
.- Parameters:
option
- TheFreeColAction
to make a user interface for.editable
- boolean whether user can modify the setting
-
-
Method Detail
-
getRecordImage
public static javax.swing.ImageIcon getRecordImage()
Creates an icon for symbolizing the recording of aKeyStroke
.- Returns:
- The
ImageIcon
.
-
getRemoveImage
public static javax.swing.ImageIcon getRemoveImage()
Creates an icon to be used on the button that removes a keyboard accelerator.- Returns:
- The
ImageIcon
.
-
getHumanKeyStrokeText
public static java.lang.String getHumanKeyStrokeText(javax.swing.KeyStroke keyStroke)
Gets a string to represent the givenKeyStroke
to the user.- Parameters:
keyStroke
-java.awt.event.KeyStroke
- Returns:
- String
-
removeKeyStroke
public void removeKeyStroke(javax.swing.KeyStroke k)
Removes the givenKeyStroke
. That is: This action'sKeyStroke
is set tonull
if it is the same as the givenKeyStroke
.- Parameters:
k
- TheKeyStroke
to be removed.
-
setOptionGroupUI
public void setOptionGroupUI(OptionGroupUI ui)
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent ae)
- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
-
getComponent
public javax.swing.JPanel getComponent()
Get theComponent
used to set the value of the Option.- Specified by:
getComponent
in classOptionUI<FreeColAction>
- Returns:
- a
JComponent
value
-
updateOption
public void updateOption()
Update the value of the Option from the UI's component.- Specified by:
updateOption
in interfaceOptionUpdater
- Specified by:
updateOption
in classOptionUI<FreeColAction>
-
reset
public void reset()
Reset the value of the UI's component from the Option.- Specified by:
reset
in interfaceOptionUpdater
- Specified by:
reset
in classOptionUI<FreeColAction>
-
-