Java tutorial
//package com.java2s; import java.awt.Dimension; import java.awt.Toolkit; public class Main { public static Dimension currentWindowSize(double widthRatio, double heightRatio) { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); Dimension rtnDim = new Dimension(); rtnDim.width = new Double(dim.getWidth() * widthRatio).intValue(); rtnDim.height = new Double(dim.getHeight() * heightRatio).intValue(); return rtnDim; } }