Here you can find the source of getDesktopSize()
public static Dimension getDesktopSize()
//package com.java2s; /**/*w w w . j a va2 s . c o m*/ * <p> * This class contains useful methods for positioning, sizing, and manipulating JFrames and other * Window-like elements. * </p> * <p> * <span class="BSDLicense"> This software is distributed under the <a * href="http://hci.stanford.edu/research/copyright.txt">BSD License</a>. </span> * </p> * * @author <a href="http://graphics.stanford.edu/~ronyeh">Ron B Yeh</a> (ronyeh(AT)cs.stanford.edu) */ import java.awt.*; public class Main { private static Rectangle desktopBounds = new Rectangle(0, 0, 640, 480); /** * @return the size of the user's desktop */ public static Dimension getDesktopSize() { return desktopBounds.getSize(); } }