Here you can find the source of getMaxUsableScreenSize()
public static Dimension getMaxUsableScreenSize()
//package com.java2s; /*//from w w w.ja v a2s . c o m * Copyright 2004-2010 Information & Software Engineering Group (188/1) * Institute of Software Technology and Interactive Systems * Vienna University of Technology, Austria * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.ifs.tuwien.ac.at/dm/somtoolbox/license.html * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.awt.Dimension; import java.awt.GraphicsEnvironment; import java.awt.Toolkit; public class Main { public static Dimension getMaxUsableScreenSize() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // we don't directly use the width from the Toolkit, as on multi-screen twin displays, it gives the total // width of all displays // thus, we take the smaller value of the toolkit's and the graphics environment // we don't take the graphics environment directly, as that gives the total, and not just the usable width // i.e. it doesn't take a left/right (i.e. vertical) toolbar into account // thus, this approach should work fine on single-display screens with a vertical toolbar, // as well as on multi-screen displays w/o such a vertical toolbar // it will most probably not work well on multi-screen displays with a vertical toolbar, as the frame will // be too wide screenSize.width = Math.min(screenSize.width, GraphicsEnvironment .getLocalGraphicsEnvironment().getDefaultScreenDevice() .getDisplayMode().getWidth()); screenSize.height -= 48; return screenSize; } }