public Properties getWindowPositions() { if (windowPositions == null) { windowPositions = new Properties(); FileInputStream in = null; try { in = new FileInputStream(FileUtil.getWindowConfigFile()); windowPositions.load(in); } catch (FileNotFoundException e) { Logger.logMessage("Creating " + FileUtil.getWindowConfigFile().getName() + " file"); } catch (Exception e) { Logger.logError(e); } finally { if (in != null) { try { in.close(); } catch (IOException ignored) {} } } } return windowPositions; }
public void saveWindowPositions() { FileOutputStream out = null; try { out = new FileOutputStream(FileUtil.getWindowConfigFile()); getWindowPositions().store(out, "Robocode window sizes"); } catch (IOException e) { Logger.logWarning("Unable to save window positions: " + e); } finally { if (out != null) { try { out.close(); } catch (IOException ignored) {} } } }