Java JFrame rightShiftDialog(JDialog dialog, JFrame parent)

Here you can find the source of rightShiftDialog(JDialog dialog, JFrame parent)

Description

right Shift Dialog

License

Open Source License

Declaration

static public void rightShiftDialog(JDialog dialog, JFrame parent) 

Method Source Code


//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);
    }
}

Related

  1. registerMenuShortcut(String uniqueActionName, Action action, int keyCode, JFrame frame)
  2. renderDialog(JFrame theframe, String szMessage, int noffsetx, int noffsety)
  3. replaceGlassPane(JFrame frame, Component newGlassPane)
  4. restoreFrame(Class pClass, final JFrame pFrame, String pFrameId)
  5. restoreFrame(JFrame frame)
  6. run(JFrame frame, int width, int height)
  7. saveFrame(Class pClass, JFrame pFrame, String pFrameId)
  8. saveMainWindowLocation(JFrame jfrm, String strPropertiesFilePath, String strPropertiesFileName)
  9. setBlockAllUserInput(final JFrame frame, final boolean yesNo)