void saveWindowLocations() { Window win = WindowManager.getWindow("B&C"); if (win != null) Prefs.saveLocation(ContrastAdjuster.LOC_KEY, win.getLocation()); win = WindowManager.getWindow("Threshold"); if (win != null) Prefs.saveLocation(ThresholdAdjuster.LOC_KEY, win.getLocation()); win = WindowManager.getWindow("Results"); if (win != null) { Prefs.saveLocation(TextWindow.LOC_KEY, win.getLocation()); Dimension d = win.getSize(); Prefs.set(TextWindow.WIDTH_KEY, d.width); Prefs.set(TextWindow.HEIGHT_KEY, d.height); } win = WindowManager.getWindow("Log"); if (win != null) { Prefs.saveLocation(TextWindow.LOG_LOC_KEY, win.getLocation()); Dimension d = win.getSize(); Prefs.set(TextWindow.LOG_WIDTH_KEY, d.width); Prefs.set(TextWindow.LOG_HEIGHT_KEY, d.height); } win = WindowManager.getWindow("ROI Manager"); if (win != null) Prefs.saveLocation(RoiManager.LOC_KEY, win.getLocation()); }
/** * Saves the window state to the given properties map. * * @param aNamespace the namespace to use for the window state; * @param aProperties the properties to fill; * @param aWindow the window to save the state for. */ public static void saveWindowState(final Preferences aProperties, final Window aWindow) { // Special case: for FileDialog/JFileChooser we also store the properties... saveFileDialogState(aProperties, aWindow); final Point location = aWindow.getLocation(); aProperties.put("winXpos", Integer.toString(location.x)); aProperties.put("winYpos", Integer.toString(location.y)); if (isNonResizableWindow(aWindow)) { // In case the window cannot be resized, don't restore its width & // height... return; } final Dimension dims = aWindow.getSize(); aProperties.put("winWidth", Integer.toString(dims.width)); aProperties.put("winHeight", Integer.toString(dims.height)); }