Here you can find the source of giveFrameHalfScreen(final JFrame frame)
private static void giveFrameHalfScreen(final JFrame frame)
//package com.java2s; //License from project: LGPL import javax.swing.*; import java.awt.*; public class Main { private static void giveFrameHalfScreen(final JFrame frame) { final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); final Rectangle winSize = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); final int taskBarHeight = screenSize.height - winSize.height; final int width = (int) (screenSize.width * 0.505); final int height = screenSize.height - taskBarHeight; frame.setSize(width, height);/* www . j ava 2 s. c om*/ } }