Here you can find the source of rightShiftDialog(JDialog dialog, JFrame parent)
static public void rightShiftDialog(JDialog dialog, JFrame parent)
//package com.java2s; // it under the terms of the GNU General Public License as published by import javax.swing.*; import java.awt.*; public class Main { static public void rightShiftDialog(JDialog dialog, JFrame parent) { Point p = parent.getLocationOnScreen(); p.x += parent.getWidth();//from www . j ava 2 s. co m p.y += ((parent.getHeight() - dialog.getHeight()) / 2); if (p.y <= 0) p.y = 20; if (p.x <= 0) p.x = 20; dialog.setLocation(p); } }