1 package jp.co.areaweb.tools.gui;
\r
3 import java.awt.event.*;
\r
5 @SuppressWarnings("serial")
\r
6 public class QuitDialog extends Dialog
\r
8 // Used for addNotify check.
\r
9 boolean fComponentsAdjusted = false;
\r
11 //{{DECLARE_CONTROLS
\r
12 java.awt.Button yesButton;
\r
13 java.awt.Button noButton;
\r
14 java.awt.Label label1;
\r
17 class SymWindow extends java.awt.event.WindowAdapter
\r
19 public void windowClosing(java.awt.event.WindowEvent event)
\r
21 Object object = event.getSource();
\r
22 if (object == QuitDialog.this)
\r
23 QuitDialog_WindowClosing(event);
\r
27 class SymAction implements java.awt.event.ActionListener
\r
29 public void actionPerformed(java.awt.event.ActionEvent event)
\r
31 Object object = event.getSource();
\r
32 if (object == noButton)
\r
33 noButton_Clicked(event);
\r
34 else if (object == yesButton)
\r
35 yesButton_Clicked(event);
\r
39 public QuitDialog(Frame parent, boolean modal)
\r
41 super(parent, modal);
\r
43 // This code is automatically generated by Visual Cafe when you add
\r
44 // components to the visual environment. It instantiates and initializes
\r
45 // the components. To modify the code, only use code syntax that matches
\r
46 // what Visual Cafe can generate, or Visual Cafe may be unable to back
\r
47 // parse your Java file into its visual environment.
\r
50 setSize(getInsets().left + getInsets().right + 337,getInsets().top + getInsets().bottom + 135);
\r
51 yesButton = new java.awt.Button(" Yes ");
\r
52 yesButton.setBounds(getInsets().left + 72,getInsets().top + 80,79,22);
\r
53 yesButton.setFont(new Font("Dialog", Font.BOLD, 12));
\r
55 noButton = new java.awt.Button(" No ");
\r
56 noButton.setBounds(getInsets().left + 185,getInsets().top + 80,79,22);
\r
57 noButton.setFont(new Font("Dialog", Font.BOLD, 12));
\r
59 label1 = new java.awt.Label("Do you really want to quit?",Label.CENTER);
\r
60 label1.setBounds(78,33,180,23);
\r
62 setTitle("DbMang - Quit");
\r
63 setResizable(false);
\r
66 //{{REGISTER_LISTENERS
\r
67 SymWindow aSymWindow = new SymWindow();
\r
68 addWindowListener(aSymWindow);
\r
69 SymAction lSymAction = new SymAction();
\r
70 noButton.addActionListener(lSymAction);
\r
71 yesButton.addActionListener(lSymAction);
\r
75 public void addNotify()
\r
77 // Record the size of the window prior to calling parents addNotify.
\r
78 Dimension d = getSize();
\r
82 if (fComponentsAdjusted)
\r
85 // Adjust components according to the insets
\r
86 setSize(getInsets().left + getInsets().right + d.width, getInsets().top + getInsets().bottom + d.height);
\r
87 Component components[] = getComponents();
\r
88 for (int i = 0; i < components.length; i++)
\r
90 Point p = components[i].getLocation();
\r
91 p.translate(getInsets().left, getInsets().top);
\r
92 components[i].setLocation(p);
\r
94 fComponentsAdjusted = true;
\r
97 public QuitDialog(Frame parent, String title, boolean modal)
\r
99 this(parent, modal);
\r
104 * Shows or hides the component depending on the boolean flag b.
\r
105 * @param b if true, show the component; otherwise, hide the component.
\r
106 * @see java.awt.Component#isVisible
\r
108 public void setVisible(boolean b)
\r
112 Rectangle bounds = getParent().getBounds();
\r
113 Rectangle abounds = getBounds();
\r
115 setLocation(bounds.x + (bounds.width - abounds.width)/ 2,
\r
116 bounds.y + (bounds.height - abounds.height)/2);
\r
118 super.setVisible(b);
\r
121 void QuitDialog_WindowClosing(java.awt.event.WindowEvent event)
\r
126 void yesButton_Clicked(java.awt.event.ActionEvent event)
\r
128 Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent((java.awt.Window)getParent(), WindowEvent.WINDOW_CLOSING));
\r
131 void noButton_Clicked(java.awt.event.ActionEvent event)
\r