1 package hayashi.yuu.tools.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 public class QuitDialog extends JDialog implements WindowListener
21 public QuitDialog(JFrame parent, boolean modal) {
23 addWindowListener((WindowListener) this);
24 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
27 setSize(getInsets().left + getInsets().right + 337, getInsets().top + getInsets().bottom + 135);
29 yesButton = new JButton(" 終了 ");
30 yesButton.addActionListener(new java.awt.event.ActionListener() {
31 public void actionPerformed(java.awt.event.ActionEvent evt) {
32 Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent((Window)getParent(), 201));
36 yesButton.setBounds(getInsets().left + 72, getInsets().top + 80, 79, 22);
37 yesButton.setFont(new Font("Dialog", 1, 12));
40 noButton = new JButton("キャンセル");
41 noButton.addActionListener(new java.awt.event.ActionListener() {
42 public void actionPerformed(java.awt.event.ActionEvent evt) {
43 Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(QuitDialog.this, WindowEvent.WINDOW_CLOSING));
47 noButton.setBounds(getInsets().left + 185, getInsets().top + 80, 99, 22);
48 noButton.setFont(new Font("Dialog", 1, 12));
51 label1 = new JLabel("プログラムを終了します。", JLabel.CENTER);
52 label1.setBounds(78, 33, 180, 23);
59 public void setVisible(boolean b) {
61 Rectangle bounds = getParent().getBounds();
62 Rectangle abounds = getBounds();
63 setLocation(bounds.x + (bounds.width - abounds.width) / 2, bounds.y + (bounds.height - abounds.height) / 2);
69 public void windowActivated(WindowEvent e) {
72 public void windowClosed(WindowEvent e) {
76 public void windowClosing(WindowEvent e) {
80 public void windowDeactivated(WindowEvent e) {
83 public void windowDeiconified(WindowEvent e) {
86 public void windowIconified(WindowEvent e) {
89 public void windowOpened(WindowEvent e) {