/** * Stores the current location/size of a frame to the properties file. * * @param frame the frame to position. * @param name the name under which to store the property */ public void saveFrame(Frame frame, int windowID) { WindowPosition windowPos = windowCoords.get(windowID); if (windowPos == null) windowPos = new WindowPosition(); Rectangle newRect = new Rectangle(frame.getSize()); newRect.setLocation(frame.getX(), frame.getY()); windowPos.setRect(newRect); windowCoords.put(windowID, windowPos); }
/** Returns the {@link WindowPosition}. */ public WindowPosition getPosition() { String literal = options.getLiteral("position"); return literal == null ? WindowPosition.CENTER : WindowPosition.valueOf(literal.toUpperCase()); }
/** * Sets the window's position. * * @return instance of the current component */ public Dialog setPosition(WindowPosition windowPosition) { options.putLiteral("position", windowPosition.name().toLowerCase()); return this; // TODO change the parameter of this method }