OSDN Git Service

GPX: <trkseg>セグメントの最初の1ノードは無視する。
[importpicture/importpicture.git] / importPicture / src / osm / jp / gpx / matchtime / gui / QuitDialog.java
1 package osm.jp.gpx.matchtime.gui;
2
3 import java.awt.Font;
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;
9
10 import javax.swing.JButton;
11 import javax.swing.JDialog;
12 import javax.swing.JFrame;
13 import javax.swing.JLabel;
14
15 @SuppressWarnings("serial")
16 public class QuitDialog extends JDialog implements WindowListener
17 {
18         public static final String TITLE = "終了?";
19     JButton yesButton;
20     JButton noButton;
21     JLabel label1;
22
23     public QuitDialog(JFrame parent, boolean modal) {
24         super(parent, modal);
25         addWindowListener((WindowListener) this);
26         setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
27
28         setLayout(null);
29         setSize(getInsets().left + getInsets().right + 337, getInsets().top + getInsets().bottom + 135);
30         
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));
35                 System.exit(0);
36                 }
37         });
38         yesButton.setBounds(getInsets().left + 72, getInsets().top + 80, 79, 22);
39         yesButton.setFont(new Font("Dialog", 1, 12));
40         add(yesButton);
41
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));
46                         setVisible(false);
47                 }
48         });
49         noButton.setBounds(getInsets().left + 185, getInsets().top + 80, 99, 22);
50         noButton.setFont(new Font("Dialog", 1, 12));
51         add(noButton);
52         
53         label1 = new JLabel("プログラムを終了します。", JLabel.CENTER);
54         label1.setBounds(78, 33, 180, 23);
55         add(label1);
56         setTitle("プログラムの終了");
57         setResizable(false);
58         setVisible(true);
59     }
60
61     public void setVisible(boolean b) {
62         if(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);
66         }
67         super.setVisible(b);
68     }
69
70
71         public void windowActivated(WindowEvent e) {
72         }
73
74         public void windowClosed(WindowEvent e) {
75                 setVisible(false);
76         }
77
78         public void windowClosing(WindowEvent e) {
79                 setVisible(false);
80         }
81
82         public void windowDeactivated(WindowEvent e) {
83         }
84
85         public void windowDeiconified(WindowEvent e) {
86         }
87
88         public void windowIconified(WindowEvent e) {
89         }
90
91         public void windowOpened(WindowEvent e) {
92         }
93 }