}
}
private void loadUserPrefs() {
logger.finer("Getting user preferences...");
OwnPreferences prefs = OwnPreferences.userNodeForPackage(this.getClass());
int xPos = 50;
int yPos = 50;
int with = 960;
int height = 700;
int x = prefs.getInt(MainFrame.FRAME_X, xPos);
int y = prefs.getInt(MainFrame.FRAME_Y, yPos);
int h = prefs.getInt(MainFrame.FRAME_HEIGHT, height);
int w = prefs.getInt(MainFrame.FRAME_WIDTH, with);
this.setSize(new Dimension(w, h));
if (x == xPos && y == yPos) {
logger.finer("Position in middle of window. Seems to be used for the first time.");
this.setLocationRelativeTo(null); //center it
} else {
logger.finer("Position of window: x='" + x + "', y='" + y + "'. Size of window: h='" + h + "', w='" + w + "'.");
this.setLocation(x, y);
}
this.restoreMainDividerLocation();
int i = prefs.getInt(MainFrame.GUI_DIVIDER_LOCATION_VERTICAL, 200);
this.jSplitPaneTreeControls.setDividerLocation(i);
// Restore the file extension for command files. They are generated
// every time the config is saved or started. On Windows this cmd will
// start XPlanet and the Downloader.
MainFrame.FILE_EXTENSION_CMD_FILE = prefs.get(MainFrame.KEY_SUFFIX_CMD_FILE, "cmd");
String osName = System.getProperty("os.name");
if (osName != null) {
// Guess for Windows
if (osName.matches("(?i).*windows.+")) {
MainFrame.FILE_EXTENSION_CMD_FILE = prefs.get(MainFrame.KEY_SUFFIX_CMD_FILE, "cmd");
}
// TODO: Implement for Linux and Mac
}
// Restore the config name
MainFrame.setCONFIG_NAME(prefs.get(MainFrame.KEY_CONFIG_NAME, ""));
// Restore expert mode or non expert mode
boolean b = prefs.getBoolean(MainFrame.KEY_USING_EXPERT_MODE, false);
this.jCheckBoxExpertMode.setSelected(b);
b = prefs.getBoolean(MainFrame.KEY_ALLOW_INTERNET_CONNECTION, true);
this.jCheckBoxMenuItemAllowInternetConnection.setSelected(b);
boolean showHideDialog = prefs.getBoolean(MainFrame.KEY_SHOW_HIDE_DIALOG, true);
this.setIsShowinHideDialog(showHideDialog);
boolean runAndHide = prefs.getBoolean(MainFrame.KEY_RUN_AT_STARTUP, false);
this.jCheckBoxMenuItemRunAtStartUp.setSelected(runAndHide);
}