Java Window getWindowNormalBounds(Window window)

Here you can find the source of getWindowNormalBounds(Window window)

Description

Gets Window bounds from the client property

License

Open Source License

Parameter

Parameter Description
window the source Window

Return

bounds from the client property

Declaration

public static Rectangle getWindowNormalBounds(Window window) 

Method Source Code

//package com.java2s;
/*//w  w w  .j  ava 2 s.  co  m
 * Copyright (C) 2009 Illya Yalovyy
 * Use is subject to license terms.
 */

import java.awt.Rectangle;
import java.awt.Window;
import javax.swing.JFrame;

public class Main {
    private static final String WINDOW_STATE_NORMAL_BOUNDS = "WindowState.normalBounds";

    /**
     * Gets {@code Window} bounds from the client property
     * @param window the source {@code Window}
     * @return bounds from the client property
     */
    public static Rectangle getWindowNormalBounds(Window window) {
        if (window instanceof JFrame) {
            Object res = ((JFrame) window).getRootPane().getClientProperty(WINDOW_STATE_NORMAL_BOUNDS);
            if (res instanceof Rectangle) {
                return (Rectangle) res;
            }
        }
        return null;
    }
}

Related

  1. fadeOut(final Window window, final boolean dispose)
  2. flashMessage(final Window parent, String string)
  3. getVisibleWindowByName(String name)
  4. getWindow(final Object source)
  5. getWindow(String title)
  6. getWindowTitle(Window window)
  7. getWindowTitle(Window window)
  8. growIfNecessary(Window window)
  9. hideWaitPane(Window win, Timer timer)