Java tutorial
//package com.java2s; //License from project: Apache License import java.awt.GraphicsEnvironment; import java.awt.Insets; import java.awt.Toolkit; import java.awt.Window; public class Main { public static Insets getScreenInsets(Window win) { Insets si; if (win == null) { si = Toolkit.getDefaultToolkit().getScreenInsets(GraphicsEnvironment.getLocalGraphicsEnvironment() .getDefaultScreenDevice().getDefaultConfiguration()); } else { si = win.getToolkit().getScreenInsets(win.getGraphicsConfiguration()); } return si; } }