1 package osm.jp.gpx.matchtime.gui;
4 import java.awt.Rectangle;
5 import java.awt.Toolkit;
6 import java.awt.Window;
7 import java.awt.event.WindowEvent;
8 import java.awt.event.WindowListener;
10 import javax.swing.JButton;
11 import javax.swing.JDialog;
12 import javax.swing.JFrame;
13 import javax.swing.JLabel;
15 @SuppressWarnings("serial")
16 public class QuitDialog extends JDialog implements WindowListener
18 public static final String TITLE = "終了?";
23 public QuitDialog(JFrame parent, boolean modal) {
25 addWindowListener((WindowListener) this);
26 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
29 setSize(getInsets().left + getInsets().right + 337, getInsets().top + getInsets().bottom + 135);
31 yesButton = new JButton(" 終了 ");
32 yesButton.addActionListener(new java.awt.event.ActionListener() {
33 public void actionPerformed(java.awt.event.ActionEvent evt) {
34 Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent((Window)getParent(), 201));
38 yesButton.setBounds(getInsets().left + 72, getInsets().top + 80, 79, 22);
39 yesButton.setFont(new Font("Dialog", 1, 12));
42 noButton = new JButton("キャンセル");
43 noButton.addActionListener(new java.awt.event.ActionListener() {
44 public void actionPerformed(java.awt.event.ActionEvent evt) {
45 Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(QuitDialog.this, WindowEvent.WINDOW_CLOSING));
49 noButton.setBounds(getInsets().left + 185, getInsets().top + 80, 99, 22);
50 noButton.setFont(new Font("Dialog", 1, 12));
53 label1 = new JLabel("プログラムを終了します。", JLabel.CENTER);
54 label1.setBounds(78, 33, 180, 23);
61 public void setVisible(boolean b) {
63 Rectangle bounds = getParent().getBounds();
64 Rectangle abounds = getBounds();
65 setLocation(bounds.x + (bounds.width - abounds.width) / 2, bounds.y + (bounds.height - abounds.height) / 2);
71 public void windowActivated(WindowEvent e) {
74 public void windowClosed(WindowEvent e) {
78 public void windowClosing(WindowEvent e) {
82 public void windowDeactivated(WindowEvent e) {
85 public void windowDeiconified(WindowEvent e) {
88 public void windowIconified(WindowEvent e) {
91 public void windowOpened(WindowEvent e) {