Java Rectangle Bounds storeWindowBounds(java.awt.Window window, java.util.prefs.Preferences prefs)

Here you can find the source of storeWindowBounds(java.awt.Window window, java.util.prefs.Preferences prefs)

Description

store Window Bounds

License

Open Source License

Declaration

static public void storeWindowBounds(java.awt.Window window, java.util.prefs.Preferences prefs) 

Method Source Code

//package com.java2s;
// This copy of Ice is licensed to you under the terms described in the

import java.awt.Rectangle;

public class Main {
    static public void storeWindowBounds(java.awt.Window window, java.util.prefs.Preferences prefs) {
        if (window instanceof java.awt.Frame) {
            java.awt.Frame frame = (java.awt.Frame) window;
            boolean maximized = frame.getExtendedState() == java.awt.Frame.MAXIMIZED_BOTH;
            prefs.putBoolean("maximized", maximized);
        }/*w  w  w.  j  a v  a  2 s . co m*/

        Rectangle rect = window.getBounds();
        prefs.putInt("x", rect.x);
        prefs.putInt("y", rect.y);
        prefs.putInt("width", rect.width);
        prefs.putInt("height", rect.height);
    }
}

Related

  1. getLocalBounds(Rectangle bounds, Container c)
  2. getRectangleListBounds(Vector vctRectangles)
  3. isInCollision(Rectangle boundedBoxPlayer, Rectangle boundedBoxObject)
  4. setBounds(Container container, Component component, Rectangle bounds)
  5. setBounds(java.awt.Rectangle hole, int xA, int yA, int xB, int yB)