Here you can find the source of showDialog(JDialog d)
public static void showDialog(JDialog d)
//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); } }