Java JDialog Show showDialog(JDialog d)

Here you can find the source of showDialog(JDialog d)

Description

show Dialog

License

Apache License

Declaration

public static void showDialog(JDialog d) 

Method Source Code

//package com.java2s;
/**/*from ww  w.  j a v  a2  s  . co m*/
 * SlingBeans - NetBeans Sling plugin https://github.com/jkan997/SlingBeans
 * Licensed under Apache 2.0 license http://www.apache.org/licenses/LICENSE-2.0
 */

import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JDialog;

public class Main {
    public static void showDialog(JDialog d) {
        final Toolkit toolkit = Toolkit.getDefaultToolkit();
        final Dimension screenSize = toolkit.getScreenSize();
        final int x = (screenSize.width - d.getWidth()) / 2;
        final int y = (screenSize.height - d.getHeight()) / 2;
        d.setLocation(x, y);
        d.setVisible(true);
    }
}

Related

  1. isShowing(JDialog f)
  2. show(JDialog dlg)
  3. showDialog(JDialog dlg, Component parent)
  4. showErrorMessage(JDialog dialog, String msg)