package org.Algy.dialogs; import java.awt.BorderLayout; import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JLabel; import javax.swing.SwingConstants; import java.awt.GridLayout; import java.awt.Dialog.ModalExclusionType; import java.awt.Dialog.ModalityType; public class WaitDialog extends JDialog { /** * */ private static final long serialVersionUID = -8264025886507152648L; private final JPanel contentPanel = new JPanel(); /** * Launch the application. */ public static void main(String[] args) { try { WaitDialog dialog = new WaitDialog(); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } /** * Create the dialog. */ public WaitDialog() { setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE); setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); setModalityType(ModalityType.APPLICATION_MODAL); setTitle("Please wait..."); setBounds(100, 100, 361, 123); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new BorderLayout(0, 0)); { JLabel lblWait = new JLabel("Please wait a minute..."); lblWait.setHorizontalAlignment(SwingConstants.CENTER); contentPanel.add(lblWait); } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); } } }