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 aModOption
in order to enable values to be both seen and changed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ModOptionUI.BoxRenderer
private static class
ModOptionUI.ModOptionRenderer
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.JComboBox<FreeColModFile>
box
The selection box for the various mod files.
-
Constructor Summary
Constructors Constructor Description ModOptionUI(ModOption option, boolean editable)
Creates a newModOptionUI
for the givenModOption
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.swing.JComboBox
getComponent()
Get theComponent
used to set the value of the Option.javax.swing.ListCellRenderer
getListCellRenderer()
Get a ListCellRenderer suitable for the wrapped Option.private static void
labelModFile(javax.swing.JLabel label, FreeColModFile modFile)
Add information from a mod file to a label.void
reset()
Reset the value of the UI's component from the Option.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, 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 newModOptionUI
for the givenModOption
.- Parameters:
option
- TheModOption
to 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
- TheJLabel
to modify.modFile
- TheFreeColModFile
to use.
-
getListCellRenderer
public javax.swing.ListCellRenderer getListCellRenderer()
Get a ListCellRenderer suitable for the wrapped Option.- Overrides:
getListCellRenderer
in classOptionUI<ModOption>
- Returns:
- A suitable ListCellRenderer.
-
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<ModOption>
-
getComponent
public javax.swing.JComboBox getComponent()
Get theComponent
used to set the value of the Option.- Specified by:
getComponent
in classOptionUI<ModOption>
- Returns:
- a
JComponent
value
-
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<ModOption>
-
-