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;
9 import java.util.ResourceBundle;
11 import javax.swing.JButton;
12 import javax.swing.JDialog;
13 import javax.swing.JFrame;
14 import javax.swing.JLabel;
16 @SuppressWarnings("serial")
17 public class QuitDialog extends JDialog implements WindowListener
23 public QuitDialog(JFrame parent, boolean modal) {
26 ResourceBundle i18n = ResourceBundle.getBundle("i18n");
28 addWindowListener((WindowListener) this);
29 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
32 setSize(getInsets().left + getInsets().right + 337, getInsets().top + getInsets().bottom + 135);
34 yesButton = new JButton(String.format(" %s ", i18n.getString("dialog.quit")));
35 yesButton.addActionListener(new java.awt.event.ActionListener() {
37 public void actionPerformed(java.awt.event.ActionEvent evt) {
38 Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent((Window)getParent(), 201));
42 yesButton.setBounds(getInsets().left + 72, getInsets().top + 80, 79, 22);
43 yesButton.setFont(new Font("Dialog", 1, 12));
46 noButton = new JButton(i18n.getString("dialog.cancel"));
47 noButton.addActionListener(new java.awt.event.ActionListener() {
49 public void actionPerformed(java.awt.event.ActionEvent evt) {
50 Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(QuitDialog.this, WindowEvent.WINDOW_CLOSING));
54 noButton.setBounds(getInsets().left + 185, getInsets().top + 80, 99, 22);
55 noButton.setFont(new Font("Dialog", 1, 12));
58 label1 = new JLabel(i18n.getString("dialog.msg1"), JLabel.CENTER);
59 label1.setBounds(78, 33, 180, 23);
61 setTitle(i18n.getString("dialog.msg1"));
67 public void setVisible(boolean b) {
69 Rectangle bounds = getParent().getBounds();
70 Rectangle abounds = getBounds();
71 setLocation(bounds.x + (bounds.width - abounds.width) / 2, bounds.y + (bounds.height - abounds.height) / 2);
78 public void windowActivated(WindowEvent e) {
82 public void windowClosed(WindowEvent e) {
87 public void windowClosing(WindowEvent e) {
92 public void windowDeactivated(WindowEvent e) {
96 public void windowDeiconified(WindowEvent e) {
100 public void windowIconified(WindowEvent e) {
104 public void windowOpened(WindowEvent e) {