Java examples for Swing:Screen
create Wait Window
//package com.java2s; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.Window; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.WindowConstants; public class Main { public static JDialog createWaitWindow(JFrame parent) { JDialog dialog = new JDialog(parent, "Wait, please...", true); dialog.add(new JLabel("Wait, please, operation is in progress...")); dialog.setSize(new Dimension(300, 100)); dialog.setResizable(false);/*from w w w. j a v a 2 s . com*/ moveToCenter(dialog); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); return dialog; } public static void moveToCenter(Window window) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); window.setLocation( (int) (screenSize.getWidth() / 2.0 - window.getWidth() / 2.0), (int) (screenSize.getHeight() / 2.0 - window.getHeight() / 2.0)); } }