Package net.sf.freecol.client.gui.option
Class ModOptionUI
- java.lang.Object
-
- net.sf.freecol.client.gui.option.OptionUI<ModOption>
-
- net.sf.freecol.client.gui.option.ModOptionUI
-
- All Implemented Interfaces:
OptionUpdater
public final class ModOptionUI extends OptionUI<ModOption>
This class provides visualization for aModOptionin order to enable values to be both seen and changed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classModOptionUI.BoxRendererprivate static classModOptionUI.ModOptionRenderer
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.JComboBox<FreeColModFile>boxThe selection box for the various mod files.
-
Constructor Summary
Constructors Constructor Description ModOptionUI(ModOption option, boolean editable)Creates a newModOptionUIfor the givenModOption.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.swing.JComboBoxgetComponent()Get theComponentused to set the value of the Option.javax.swing.ListCellRenderergetListCellRenderer()Get a ListCellRenderer suitable for the wrapped Option.private static voidlabelModFile(javax.swing.JLabel label, FreeColModFile modFile)Add information from a mod file to a label.voidreset()Reset the value of the UI's component from the Option.voidupdateOption()Update the value of the Option from the UI's component.-
Methods inherited from class net.sf.freecol.client.gui.option.OptionUI
getJLabel, getOption, getOptionUI, initialize, isEditable, setEditable, setEnabler, setLabel, setOption
-
-
-
-
Field Detail
-
box
private final javax.swing.JComboBox<FreeColModFile> box
The selection box for the various mod files.
-
-
Constructor Detail
-
ModOptionUI
public ModOptionUI(ModOption option, boolean editable)
Creates a newModOptionUIfor the givenModOption.- Parameters:
option- TheModOptionto make a user interface foreditable- boolean whether user can modify the setting
-
-
Method Detail
-
labelModFile
private static void labelModFile(javax.swing.JLabel label, FreeColModFile modFile)Add information from a mod file to a label.- Parameters:
label- TheJLabelto modify.modFile- TheFreeColModFileto use.
-
getListCellRenderer
public javax.swing.ListCellRenderer getListCellRenderer()
Get a ListCellRenderer suitable for the wrapped Option.- Overrides:
getListCellRendererin classOptionUI<ModOption>- Returns:
- A suitable ListCellRenderer.
-
updateOption
public void updateOption()
Update the value of the Option from the UI's component.- Specified by:
updateOptionin interfaceOptionUpdater- Specified by:
updateOptionin classOptionUI<ModOption>
-
getComponent
public javax.swing.JComboBox getComponent()
Get theComponentused to set the value of the Option.- Specified by:
getComponentin classOptionUI<ModOption>- Returns:
- a
JComponentvalue
-
reset
public void reset()
Reset the value of the UI's component from the Option.- Specified by:
resetin interfaceOptionUpdater- Specified by:
resetin classOptionUI<ModOption>
-
-