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) classFreeColActionUI.BlinkingLabelLabel for displaying aKeyStroke.
-
Field Summary
Fields Modifier and Type Field Description private FreeColActionUI.BlinkingLabelblprivate javax.swing.KeyStrokekeyStrokeprivate OptionGroupUIoptionGroupUIprivate javax.swing.JPanelpanelprivate javax.swing.JButtonrecordButtonprivate javax.swing.JButtonremoveButton
-
Constructor Summary
Constructors Constructor Description FreeColActionUI(FreeColAction option, boolean editable)Creates a newFreeColActionUIfor the givenFreeColAction.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent ae)javax.swing.JPanelgetComponent()Get theComponentused to set the value of the Option.static java.lang.StringgetHumanKeyStrokeText(javax.swing.KeyStroke keyStroke)Gets a string to represent the givenKeyStroketo the user.static javax.swing.ImageIcongetRecordImage()Creates an icon for symbolizing the recording of aKeyStroke.static javax.swing.ImageIcongetRemoveImage()Creates an icon to be used on the button that removes a keyboard accelerator.voidremoveKeyStroke(javax.swing.KeyStroke k)Removes the givenKeyStroke.voidreset()Reset the value of the UI's component from the Option.voidsetOptionGroupUI(OptionGroupUI ui)voidupdateOption()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 newFreeColActionUIfor the givenFreeColAction.- Parameters:
option- TheFreeColActionto 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 givenKeyStroketo 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'sKeyStrokeis set tonullif it is the same as the givenKeyStroke.- Parameters:
k- TheKeyStroketo be removed.
-
setOptionGroupUI
public void setOptionGroupUI(OptionGroupUI ui)
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent ae)
- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener
-
getComponent
public javax.swing.JPanel getComponent()
Get theComponentused to set the value of the Option.- Specified by:
getComponentin classOptionUI<FreeColAction>- Returns:
- a
JComponentvalue
-
updateOption
public void updateOption()
Update the value of the Option from the UI's component.- Specified by:
updateOptionin interfaceOptionUpdater- Specified by:
updateOptionin classOptionUI<FreeColAction>
-
reset
public void reset()
Reset the value of the UI's component from the Option.- Specified by:
resetin interfaceOptionUpdater- Specified by:
resetin classOptionUI<FreeColAction>
-
-