databaseUserField.setText(p.getStringValue(DATABASE_USER));
databasePasswordField.setText(p.getStringValue(DATABASE_PWD));
}
public void savePreferences() {
Preferences p = Preferences.getInstance();
p.setIntValue(LOCOMOTIVE_CONTROLES, locomotiveControlNumberModel
.getNumber().intValue());
p.setIntValue(TURNOUT_CONTROLES, switchControlNumberModel.getNumber()
.intValue());
p.setIntValue(ROUTE_CONTROLES, routeControlNumberModel.getNumber()
.intValue());
p.setStringValue(KEYBOARD_LAYOUT, keyBoardLayoutComboBox
.getSelectedItem().toString());
p.setBooleanValue(LOGGING, writeLog.isSelected());
p.setBooleanValue(FULLSCREEN, fullscreen.isSelected());
p.setBooleanValue(TABBED_TRACK, tabbedTrackCheckBox.isSelected());
p.setBooleanValue(USE_FIXED_TURNOUT_AND_ROUTE_GROUP_SIZES,
fixedTurnoutGroupSizesCheckBox.isSelected());
p.setBooleanValue(OPEN_LAST_FILE, openLastFileCheckBox.isSelected());
p.setIntValue(DEFAULT_TURNOUT_BUS, defaultTurnoutBusModel.getNumber()
.intValue());
p.setIntValue(DEFAULT_LOCOMOTIVE_BUS, defaultLocomotiveBusModel
.getNumber().intValue());
p.setIntValue(ACTIVATION_TIME, defaultActivationTimeModel.getNumber()
.intValue());
p.setIntValue(ROUTING_DELAY, defaultRoutingDelayModel.getNumber()
.intValue());
p.setIntValue(LOCK_DURATION, defaultLockDurationModel.getNumber()
.intValue());
p.setBooleanValue(INTERFACE_6051, interface6051.isSelected());
p.setStringValue(HOSTNAME, (String) hostnameTextField.getText());
p.setIntValue(PORT, Integer.parseInt(portnumberTextField.getText()));
p.setBooleanValue(AUTOCONNECT, autoconnectCheckBox.isSelected());
p.setBooleanValue(USE_DATABASE, useDatabaseCheckBox.isSelected());
p.setStringValue(DATABASE_HOST, (String) databaseHostField.getText());
p.setStringValue(DATABASE_NAME, (String) databaseNameField.getText());
p.setStringValue(DATABASE_USER, (String) databaseUserField.getText());
p.setStringValue(DATABASE_PWD, (String) databasePasswordField.getText());
try {
p.save();
} catch (FileNotFoundException e) {
ExceptionProcessor.getInstance().processException(e);
} catch (IOException e) {
ExceptionProcessor.getInstance().processException(e);
}