Here you can find the source of setSize(final Window window, final int minusX, final int minusY)
static void setSize(final Window window, final int minusX, final int minusY)
//package com.java2s; //License from project: Apache License import java.awt.Dimension; import java.awt.Toolkit; import java.awt.Window; public class Main { static void setSize(final Window window, final int minusX, final int minusY) { final Toolkit toolkit = Toolkit.getDefaultToolkit(); final Dimension screenSize = toolkit.getScreenSize(); final double screenWidth = screenSize.getWidth(); final double screenHeight = screenSize.getHeight(); final Dimension size = new Dimension((int) (screenWidth - minusX), (int) (screenHeight - minusY)); window.setBounds(minusX / 2, minusY / 2, size.width, size.height); window.setPreferredSize(size);//from w w w . ja va 2s . co m } }