Java examples for Swing:Screen
get Maximum Window Bounds
//package com.java2s; import java.awt.Dimension; import java.awt.GraphicsEnvironment; import java.awt.Rectangle; import java.awt.Toolkit; import java.lang.reflect.Method; public class Main { public static Rectangle getMaximumWindowBounds() { try {// w ww . j a va 2s . c om GraphicsEnvironment localGraphicsEnvironment = GraphicsEnvironment .getLocalGraphicsEnvironment(); Method method = GraphicsEnvironment.class .getMethod("getMaximumWindowBounds"); return (Rectangle) method.invoke(localGraphicsEnvironment); } catch (Exception e) { Dimension s = Toolkit.getDefaultToolkit().getScreenSize(); return new Rectangle(0, 0, s.width, s.height); } } }