use of com.att.aro.core.settings.impl.JvmSettings in project VideoOptimzer by attdevsupport.
the class PreferencesDialog method getValuePanel.
private Component getValuePanel(final Config config) {
int fieldHeight = Util.isLinuxOS() ? 28 : 20;
JPanel panel = new JPanel();
Dimension size = new Dimension(300, fieldHeight);
panel.setLayout(new BoxLayout(panel, LINE_AXIS));
setSize(panel, size);
if (config.getConfigType() == ConfigType.TEXT) {
panel.add(getValueTextField(config, size));
} else if (config.getConfigType() == ConfigType.MEMORY || config.getConfigType() == ConfigType.NUMBER) {
double maximumValue = 1;
JTextField textField = getValueTextField(config, size);
if (config.getConfigType() == ConfigType.MEMORY) {
maximumValue = ((JvmSettings) JvmSettings.getInstance()).getMaximumMemoryGB();
}
textField.setInputVerifier(new NumericInputVerifier(maximumValue, 2, 1, false, this));
textField.addKeyListener(getKeyListener(textField));
textField.addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent e) {
if (hider != null) {
closePopup();
}
}
@Override
public void focusGained(FocusEvent e) {
}
});
panel.add(textField);
} else if (config.getConfigType() == ConfigType.FILE) {
Dimension txtSize = new Dimension(220, fieldHeight);
final JTextField textField = getValueTextField(config, txtSize);
Dimension btnSize = new Dimension(75, fieldHeight);
JButton btnBrowse = new JButton("Browse");
setSize(btnBrowse, btnSize);
btnBrowse.addActionListener((ActionEvent e) -> setPathTextField(textField));
panel.add(textField);
panel.add(btnBrowse);
} else if (config.getConfigType() == ConfigType.COMBO) {
JComboBox<String> comboBox = new JComboBox<>(getComboValue(config));
comboBox.addActionListener((ActionEvent e) -> setLoggingLvl((String) comboBox.getSelectedItem()));
comboBox.setSelectedItem(Util.getLoggingLevel());
panel.add(comboBox);
}
return panel;
}
Aggregations