Java tutorial
//package com.java2s; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.Window; public class Main { public static void setFrameRelativeSize(Window frame, int width, int height) { //Get the screen size Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension screenSize = toolkit.getScreenSize(); //Calculate the frame location frame.setSize(screenSize.width - width, screenSize.height - height); } }