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 @SuppressWarnings("OverridableMethodCallInConstructor")
24 public QuitDialog(JFrame parent, boolean modal) {
27 ResourceBundle i18n = ResourceBundle.getBundle("i18n");
29 addWindowListener((WindowListener) this);
30 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
33 setSize(getInsets().left + getInsets().right + 337, getInsets().top + getInsets().bottom + 135);
35 yesButton = new JButton(String.format(" %s ", i18n.getString("dialog.quit")));
36 yesButton.addActionListener(new java.awt.event.ActionListener() {
38 public void actionPerformed(java.awt.event.ActionEvent evt) {
39 Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent((Window)getParent(), 201));
43 yesButton.setBounds(getInsets().left + 72, getInsets().top + 80, 79, 22);
44 yesButton.setFont(new Font("Dialog", 1, 12));
47 noButton = new JButton(i18n.getString("dialog.cancel"));
48 noButton.addActionListener(new java.awt.event.ActionListener() {
50 public void actionPerformed(java.awt.event.ActionEvent evt) {
51 Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(QuitDialog.this, WindowEvent.WINDOW_CLOSING));
55 noButton.setBounds(getInsets().left + 185, getInsets().top + 80, 99, 22);
56 noButton.setFont(new Font("Dialog", 1, 12));
59 label1 = new JLabel(i18n.getString("dialog.msg1"), JLabel.CENTER);
60 label1.setBounds(78, 33, 180, 23);
62 setTitle(i18n.getString("dialog.msg1"));
68 public void setVisible(boolean b) {
70 Rectangle bounds = getParent().getBounds();
71 Rectangle abounds = getBounds();
72 setLocation(bounds.x + (bounds.width - abounds.width) / 2, bounds.y + (bounds.height - abounds.height) / 2);
79 public void windowActivated(WindowEvent e) {
83 public void windowClosed(WindowEvent e) {
88 public void windowClosing(WindowEvent e) {
93 public void windowDeactivated(WindowEvent e) {
97 public void windowDeiconified(WindowEvent e) {
101 public void windowIconified(WindowEvent e) {
105 public void windowOpened(WindowEvent e) {