Java tutorial
//package com.java2s; import java.awt.Component; import java.awt.Dimension; import java.awt.Toolkit; public class Main { public static void resizeToScreenProportions(Component component, double xProportion, double yProportion) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension componentNewSize = new Dimension((int) (screenSize.width * yProportion), (int) (screenSize.height * xProportion)); component.setSize(componentNewSize); } public static void resizeToScreenProportions(Component component, double proportion) { resizeToScreenProportions(component, proportion, proportion); } }