Here you can find the source of setWindowDesktopSize(Window window, double sizeX, double sizeY)
public static void setWindowDesktopSize(Window window, double sizeX, double sizeY)
//package com.java2s; /* /*from w w w.j a v a 2 s .com*/ * The MIT License * * Copyright 2014 Kamnev Georgiy (nt.gocha@gmail.com). * * ??????? ????????? ?????????, ????????????, ?????, ?????????? ????? ??????? ???????????? * ????????????? ? ??????????????? ???????????? (? ?????????? ?????????? "??????????? ????????????"), * ????????????? ??????????? ???????????? ??? ???????????, ???????? ?????????????? ????? ?? * ??????????????, ???????????, ?????????, ???????????, ??????????, ?????????????????, ?????????????????? * ?/??? ??????? ????? ???????????? ?????????????, ????? ??? ? ?????, ??????? ??????????????????? * ?????? ??????????? ????????????, ??? ??????????? ?????????? ????????: * * ??????????????? ???????? ? ?????? ????????? ?????? ???? ???????? ?? ???? ????? * ??? ???????? ?????? ??????? ???????????? ?????????????. * * ????????? ????????????? ???????????? ???????????????? ????? ?????, ??? ?????? ????? ???????????, * ????? ????????????? ??? ?????????????????, ????????, ??? ??? ???????????????? ????????????? ?????????? ????????????, * ???????????? ?? ??? ????????????? ??????????????? ? ??????????????? ?????. ??? ? ?????? ??????? ??????? * ??? ?????????????????? ??? ?????? ????????????????? ?? ?????? ? ??????????? ???????, ??????? * ??? ?????? ???????????? ?? ??????????? ?????????????, ????????? ??? ??????, ?????????? ??, ??????? * ????????? ??? ???????????? ? ????????????? ????????????? ??? ???????????????? ?????????????? ???????????? * ??? ?????? ?????????? ? ????????????? ?????????????. */ import java.awt.GraphicsEnvironment; import java.awt.Window; public class Main { public static void setWindowDesktopSize(Window window, double sizeX, double sizeY) { if (window == null) { throw new IllegalArgumentException("window == null"); } if (sizeX < 0 || sizeX > 1) throw new IllegalArgumentException("size<0 | size>1"); if (sizeY < 0 || sizeY > 1) throw new IllegalArgumentException("size<0 | size>1"); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); int screenX = ge.getCenterPoint().x * 2; int screenY = ge.getCenterPoint().y * 2; window.setSize((int) ((double) screenX * sizeX), (int) ((double) screenY * sizeY)); } }