Here you can find the source of bringWindowToScreen(Window window)
public static void bringWindowToScreen(Window window)
//package com.java2s; //License from project: Apache License import java.awt.*; public class Main { public static void bringWindowToScreen(Window window) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int screenWidth = (int) screenSize.getWidth(); int screenHeight = (int) screenSize.getHeight(); Dimension size = window.getSize(); int windowWidth = (int) size.getWidth(); int windowHeight = (int) size.getHeight(); Point locationOnScreen = window.getLocationOnScreen(); int left = (int) locationOnScreen.getX(); int top = (int) locationOnScreen.getY(); if (screenWidth < left + windowWidth) { left = screenWidth - windowWidth; }//ww w . j a va 2 s . com if (screenHeight < top + windowHeight) { top = screenHeight - windowHeight; } window.setLocation(left, top); } }