home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VCafe / main.bin / QuitDialog.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-08-04  |  2.0 KB  |  74 lines

  1. package symantec.descfileconverter;
  2.  
  3. import java.awt.Button;
  4. import java.awt.Component;
  5. import java.awt.Container;
  6. import java.awt.Dialog;
  7. import java.awt.Event;
  8. import java.awt.Frame;
  9. import java.awt.Label;
  10. import java.awt.LayoutManager;
  11. import java.awt.Rectangle;
  12.  
  13. public class QuitDialog extends Dialog {
  14.    Button yesButton;
  15.    Button noButton;
  16.    Label label1;
  17.  
  18.    void yesButton_Clicked(Event var1) {
  19.       ((Component)this).getParent().handleEvent(new Event(this, 201, (Object)null));
  20.    }
  21.  
  22.    void noButton_Clicked(Event var1) {
  23.       ((Component)this).hide();
  24.       ((Component)this).getParent().requestFocus();
  25.    }
  26.  
  27.    public QuitDialog(Frame var1, boolean var2) {
  28.       super(var1, var2);
  29.       ((Container)this).setLayout((LayoutManager)null);
  30.       ((Dialog)this).addNotify();
  31.       ((Component)this).resize(((Container)this).insets().left + ((Container)this).insets().right + 250, ((Container)this).insets().top + ((Container)this).insets().bottom + 135);
  32.       this.yesButton = new Button(" Yes ");
  33.       this.yesButton.reshape(((Container)this).insets().left + 36, ((Container)this).insets().top + 84, 79, 22);
  34.       ((Container)this).add(this.yesButton);
  35.       this.noButton = new Button("  No  ");
  36.       this.noButton.reshape(((Container)this).insets().left + 144, ((Container)this).insets().top + 84, 79, 22);
  37.       ((Container)this).add(this.noButton);
  38.       this.label1 = new Label("Do you really want to quit?");
  39.       this.label1.reshape(((Container)this).insets().left + 48, ((Container)this).insets().top + 36, 149, 23);
  40.       ((Container)this).add(this.label1);
  41.       ((Dialog)this).setTitle("Description File Converter - Quit");
  42.       ((Dialog)this).setResizable(false);
  43.    }
  44.  
  45.    public QuitDialog(Frame var1, String var2, boolean var3) {
  46.       this(var1, var3);
  47.       ((Dialog)this).setTitle(var2);
  48.    }
  49.  
  50.    public synchronized void show() {
  51.       Rectangle var1 = ((Component)this).getParent().bounds();
  52.       Rectangle var2 = ((Component)this).bounds();
  53.       ((Component)this).move(var1.x + (var1.width - var2.width) / 2, var1.y + (var1.height - var2.height) / 2);
  54.       super.show();
  55.    }
  56.  
  57.    public boolean handleEvent(Event var1) {
  58.       if (var1.id == 201) {
  59.          ((Component)this).hide();
  60.          return true;
  61.       } else {
  62.          if (var1.target == this.noButton && var1.id == 1001) {
  63.             this.noButton_Clicked(var1);
  64.          }
  65.  
  66.          if (var1.target == this.yesButton && var1.id == 1001) {
  67.             this.yesButton_Clicked(var1);
  68.          }
  69.  
  70.          return super.handleEvent(var1);
  71.       }
  72.    }
  73. }
  74.