public class MemoryOption extends AbstractOption implements ActionListener
| Modifier and Type | Class and Description |
|---|---|
static class |
MemoryOption.Prefix |
private static class |
MemoryOption.State |
| Modifier and Type | Field and Description |
|---|---|
private MemoryOption.Prefix |
currentPrefix |
private MemoryOption.State |
currentState |
private String |
defaultPrefValue |
private boolean |
doneInit |
private String |
failsafeValue |
private MemoryOption.Prefix |
initPrefixValue |
private int |
initSliderValue |
private String |
initTextValue |
private JRadioButton |
jrbNumber |
private JRadioButton |
jrbSlider |
private ButtonGroup |
jtbBg |
private int |
maxmem |
private int |
maxSliderValue |
private static Pattern |
MEMSTRING |
private JComboBox |
memVals |
private int |
minSliderValue |
ChangeListener |
percentListener |
private static MemoryOption.Prefix[] |
PREFIXES |
private JSlider |
slider |
private JLabel |
sliderLabel |
private JPanel |
sliderPanel |
private McVTextField |
text |
private JPanel |
textPanel |
private String |
value |
| Constructor and Description |
|---|
MemoryOption(String id,
String label,
String defaultValue,
OptionMaster.OptionPlatform optionPlatform,
OptionMaster.Visibility optionVisibility) |
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(ActionEvent e) |
void |
fromPrefsFormat(String prefText)
Initializes the current option using a relevant variable from the
startup script.
|
JPanel |
getComponent()
Returns the GUI component that represents the option.
|
private String[] |
getNames(MemoryOption.Prefix[] arr) |
JComponent |
getSliderComponent() |
JComponent |
getTextComponent() |
String |
getValue()
Returns the value of the option.
|
private void |
handleNewValue(JTextField field,
JComboBox box) |
private boolean |
isSlider() |
private boolean |
isValid() |
private void |
setState(MemoryOption.State newState) |
void |
setValue(String newValue)
Forces the value of the option to the data specified.
|
String |
toString()
Friendly string representation of the option.
|
getLabel, getOptionId, getOptionPlatform, getOptionType, getOptionVisibility, isValidPrefFormat, onValidPlatform, toPrefsFormatprivate static final MemoryOption.Prefix[] PREFIXES
private MemoryOption.Prefix currentPrefix
private final String defaultPrefValue
private String failsafeValue
private JRadioButton jrbSlider
private JRadioButton jrbNumber
private ButtonGroup jtbBg
private JPanel sliderPanel
private JLabel sliderLabel
private McVTextField text
private String initTextValue
private MemoryOption.Prefix initPrefixValue
private int minSliderValue
private int maxSliderValue
private int initSliderValue
private int maxmem
private MemoryOption.State currentState
private boolean doneInit
public ChangeListener percentListener
public MemoryOption(String id, String label, String defaultValue, OptionMaster.OptionPlatform optionPlatform, OptionMaster.Visibility optionVisibility)
private String[] getNames(MemoryOption.Prefix[] arr)
private void setState(MemoryOption.State newState)
private boolean isValid()
private boolean isSlider()
public void actionPerformed(ActionEvent e)
actionPerformed in interface ActionListenerprivate void handleNewValue(JTextField field, JComboBox box)
public JPanel getComponent()
AbstractOptionBooleanOptions are represented by a
JCheckBox, while TextOptions appear as a
JTextField.getComponent in interface OptiongetComponent in class AbstractOptionpublic JComponent getSliderComponent()
public JComponent getTextComponent()
public String toString()
AbstractOptiontoString in interface OptiontoString in class AbstractOptionString containing relevant info about the option.TextOption.toString(),
BooleanOption.toString()public String getValue()
AbstractOptionBooleanOptions return either "0" or
"1".getValue in interface OptiongetValue in class AbstractOptionpublic void fromPrefsFormat(String prefText)
AbstractOptionfromPrefsFormat in interface OptionfromPrefsFormat in class AbstractOptionprefText - Line from the startup script that represents the current
option.public void setValue(String newValue)
AbstractOptionBooleanOptions accept either "0", or
"1".setValue in interface OptionsetValue in class AbstractOptionnewValue - New value to use.