Here you can find the source of getDesktopBounds()
public static Rectangle getDesktopBounds()
//package com.java2s; //License from project: Open Source License import java.awt.*; public class Main { /**/*ww w . java 2 s . com*/ * get the bounds of the users desktop... including if it uses multiple monitors. * See the Documentation on Class GraphicsConfiguration. */ public static Rectangle getDesktopBounds() { Rectangle virtualBounds = new Rectangle(); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gs = ge.getScreenDevices(); for (int j = 0; j < gs.length; j++) { GraphicsDevice gd = gs[j]; GraphicsConfiguration gc = gd.getDefaultConfiguration(); Rectangle rect = gc.getBounds(); if (rect != null) virtualBounds = virtualBounds.union(rect); // GraphicsConfiguration[] gc =gd.getConfigurations(); // for (int i=0; i < gc.length; i++) { // Rectangle rect = gc[i].getBounds(); // if( rect != null ) // virtualBounds = virtualBounds.union(rect); // } } return virtualBounds; } }