home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-02-06 | 1.5 KB | 62 lines |
- /*
- A basic extension of the java.awt.Dialog class
- */
-
- import java.awt.*;
-
- public class AboutDialog extends Dialog {
- void doneButton_Clicked(Event event) {
- hide();
- }
-
-
- public AboutDialog(Frame parent, boolean modal) {
-
- super(parent, modal);
-
- //{{INIT_CONTROLS
- setLayout(null);
- addNotify();
- resize(insets().left + insets().right + 327,insets().top + insets().bottom + 91);
- label1 = new java.awt.Label("A basic Java application");
- label1.reshape(insets().left + 26,insets().top + 33,181,19);
- add(label1);
- doneButton = new java.awt.Button("Done");
- doneButton.reshape(insets().left + 233,insets().top + 16,60,40);
- add(doneButton);
- setResizable(false);
- //}}
- }
-
- public AboutDialog(Frame parent, String title, boolean modal) {
- this(parent, modal);
- setTitle(title);
- }
-
- public synchronized void show() {
- Rectangle bounds = getParent().bounds();
- Rectangle abounds = bounds();
-
- move(bounds.x + (bounds.width - abounds.width)/ 2,
- bounds.y + (bounds.height - abounds.height)/2);
-
- super.show();
- }
-
- public boolean handleEvent(Event event) {
- if(event.id == Event.WINDOW_DESTROY) {
- hide();
- return true;
- }
- if (event.target == doneButton && event.id == Event.ACTION_EVENT) {
- doneButton_Clicked(event);
- }
- return super.handleEvent(event);
- }
-
- //{{DECLARE_CONTROLS
- java.awt.Label label1;
- java.awt.Button doneButton;
- //}}
- }
-