Siba/src/org/dclermonte/siba/gui/CheckDialog.java

77 lines
1.7 KiB
Java
Raw Normal View History

2016-04-12 00:41:43 +02:00
package org.dclermonte.siba.gui;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
public class CheckDialog extends JDialog
{
public static Object lblNewLabel;
public static String message;
/**
* Launch the application.
*/
public static void main(final String string)
{
message = string;
try
{
CheckDialog dialog = new CheckDialog();
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
}
catch (Exception e)
{
e.printStackTrace();
}
}
private final JPanel contentPanel = new JPanel();
/**
* Create the dialog.
*/
public CheckDialog()
{
setBounds(100, 100, 450, 300);
getContentPane().setLayout(new BorderLayout());
this.contentPanel.setLayout(new FlowLayout());
this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(this.contentPanel, BorderLayout.CENTER);
{
JLabel lblNewLabel = new JLabel(message);
this.contentPanel.add(lblNewLabel);
}
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton okButton = new JButton("OK");
okButton.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(final ActionEvent e)
{
setVisible(false);
dispose();
}
});
okButton.setActionCommand("OK");
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
}
}
}