Here you can find the source of setWindowToCenterOfScreen(Window frm)
public static void setWindowToCenterOfScreen(Window frm)
//package com.java2s; //License from project: Apache License import java.awt.Rectangle; import java.awt.Window; public class Main { public static void setWindowToCenterOfScreen(Window frm) { Rectangle screenBounds = frm.getGraphicsConfiguration().getBounds(); int center_x = screenBounds.x + screenBounds.width / 2; int center_y = screenBounds.y + screenBounds.height / 2; frm.setLocation(center_x - frm.getWidth() / 2, center_y - frm.getHeight() / 2); }/*from www. j ava 2 s .c om*/ }