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, toPrefsFormat
private 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 ActionListener
private void handleNewValue(JTextField field, JComboBox box)
public JPanel getComponent()
AbstractOption
BooleanOptions
are represented by a
JCheckBox
, while TextOptions
appear as a
JTextField
.getComponent
in interface Option
getComponent
in class AbstractOption
public JComponent getSliderComponent()
public JComponent getTextComponent()
public String toString()
AbstractOption
toString
in interface Option
toString
in class AbstractOption
String
containing relevant info about the option.TextOption.toString()
,
BooleanOption.toString()
public String getValue()
AbstractOption
BooleanOptions
return either "0" or
"1".getValue
in interface Option
getValue
in class AbstractOption
public void fromPrefsFormat(String prefText)
AbstractOption
fromPrefsFormat
in interface Option
fromPrefsFormat
in class AbstractOption
prefText
- Line from the startup script that represents the current
option.public void setValue(String newValue)
AbstractOption
BooleanOptions
accept either "0", or
"1".setValue
in interface Option
setValue
in class AbstractOption
newValue
- New value to use.