Java JDialog calculatePosition(Window parent, JDialog dialog)

Here you can find the source of calculatePosition(Window parent, JDialog dialog)

Description

calculate Position

License

Open Source License

Declaration

public static Point calculatePosition(Window parent, JDialog dialog) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.Point;
import java.awt.Window;

import javax.swing.JDialog;

public class Main {
    public static Point calculatePosition(Window parent, JDialog dialog) {
        int x = parent.getX() + (parent.getWidth() - dialog.getWidth()) / 2;
        int y = parent.getY() + (parent.getHeight() - dialog.getHeight()) / 2;
        Point p = new Point(x, y);
        return p;

    }// w  ww  . j ava 2s. c  om
}

Related

  1. adaptSize(JDialog frame, int preferredWidth, int preferredHeight)
  2. addFileOnAction(AbstractButton button, final JTextField textField, final JDialog parent)
  3. alignDialogInMiddleOfScreen(JDialog dlg)
  4. applyDefaultProperties(final JDialog comp)
  5. cascadeDialog(JDialog dialog, JDialog parent)
  6. chooseFile(final JDialog dialog, final String title)
  7. closeDialog(final JDialog dialog)
  8. commonFileDialog(JDialog parent, boolean save)