Here you can find the source of getMaxSize(Window frame)
public static Dimension getMaxSize(Window frame)
//package com.java2s; //License from project: Apache License import java.awt.*; public class Main { public static Dimension getMaxSize(Window frame) { Toolkit toolkit = Toolkit.getDefaultToolkit(); GraphicsConfiguration config = frame.getGraphicsConfiguration(); Dimension availableScreenSize = new Dimension(toolkit.getScreenSize()); Insets insets = toolkit.getScreenInsets(config); availableScreenSize.width -= (insets.left + insets.right); availableScreenSize.height -= (insets.top + insets.bottom); return availableScreenSize; }/*from ww w . j ava2 s . c om*/ private static Insets getScreenInsets(Window window) { Toolkit toolkit = Toolkit.getDefaultToolkit(); GraphicsConfiguration config = window.getGraphicsConfiguration(); return toolkit.getScreenInsets(config); } }