protected void restoreMetrics() { Preferences prefs = PreferencesManager.getInstance().getApplicationPreferences(getClass().getName()); int w = prefs.getInt(SIZE_X, DEFAULT_WIDTH); int h = prefs.getInt(SIZE_Y, DEFAULT_HEIGHT); setSize(w, h); Point defLoc = getDefaultLocation(); int x = prefs.getInt(LOC_X, defLoc.x); int y = prefs.getInt(LOC_Y, defLoc.y); Rectangle desiredRectangle = new Rectangle(x, y, w, h); if(UIUtil.isVisibleOnScreen(desiredRectangle)) { setLocation(x, y); } else { setLocation(defLoc.x, defLoc.y); } }
protected void restoreMetrics() { Preferences p = PreferencesManager.getInstance().getApplicationPreferences(getClass().getName()); int w = p.getInt(SIZE_X, 800); int h = p.getInt(SIZE_Y, 600); setSize(w, h); Point defLoc = getDefaultLocation(); int x = p.getInt(LOC_X, defLoc.x); int y = p.getInt(LOC_Y, defLoc.y); setLocation(x, y); setSize(w, h); }
protected void restoreMetrics() { Preferences p = PreferencesManager.getInstance().getApplicationPreferences(getClass().getName()); int w = p.getInt(SIZE_X, DEFAULT_WIDTH); int h = p.getInt(SIZE_Y, DEFAULT_HEIGHT); setSize(w, h); Point defLoc = getDefaultLocation(); int x = p.getInt(LOC_X, defLoc.x); int y = p.getInt(LOC_Y, defLoc.y); setLocation(x, y); setSize(w, h); }