Here you can find the source of getMaxWindowBounds(final GraphicsConfiguration gc, final boolean applyScreenInsets)
Parameter | Description |
---|---|
gc | graphics configuration |
applyScreenInsets | whether or not should extract screen insets from max bounds |
public static Rectangle getMaxWindowBounds(final GraphicsConfiguration gc, final boolean applyScreenInsets)
//package com.java2s; /*/*from w w w.j av a 2 s.com*/ * This file is part of WebLookAndFeel library. * * WebLookAndFeel library is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * WebLookAndFeel library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with WebLookAndFeel library. If not, see <http://www.gnu.org/licenses/>. */ import java.awt.*; public class Main { /** * Returns maximum window bounds for the specified graphics configuration. * * @param gc graphics configuration * @param applyScreenInsets whether or not should extract screen insets from max bounds * @return maximum window bounds for the specified graphics configuration */ public static Rectangle getMaxWindowBounds(final GraphicsConfiguration gc, final boolean applyScreenInsets) { if (gc != null) { // Note that we don't have to specify x/y offset of the screen here // It seems that maximized bounds require only bounds inside of the screen bounds, not bettween the screens overall final Rectangle b = gc.getBounds(); if (applyScreenInsets) { // Taking screen insets into account final Insets si = Toolkit.getDefaultToolkit().getScreenInsets(gc); return new Rectangle(si.left, si.top, b.width - si.left - si.right, b.height - si.top - si.bottom); } else { // Using full screen return new Rectangle(0, 0, b.width, b.height); } } else { // Default GE bounds return GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); } } }