Here you can find the source of setWindowRightSide(final JFrame frame)
public static void setWindowRightSide(final JFrame frame)
//package com.java2s; //License from project: LGPL import javax.swing.*; import java.awt.*; public class Main { public static void setWindowRightSide(final JFrame frame) { frame.setExtendedState(JFrame.NORMAL); giveFrameHalfScreen(frame);/*from w ww .j a v a 2 s .c o m*/ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice defaultScreen = ge.getDefaultScreenDevice(); Rectangle rect = defaultScreen.getDefaultConfiguration().getBounds(); int x = (int) rect.getMaxX() - frame.getWidth(); int y = 0; frame.setLocation(x, y); } 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); } }