home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD 31 / SUPERCDa.iso / Inet / HotJava / hjava.exe / Windows / resource / jre / lib / rt.jar / java / awt / Dialog.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-11  |  3.2 KB  |  148 lines

  1. package java.awt;
  2.  
  3. import java.awt.peer.DialogPeer;
  4.  
  5. public class Dialog extends Window {
  6.    boolean resizable;
  7.    boolean modal;
  8.    String title;
  9.    private static final String base = "dialog";
  10.    private static int nameCounter;
  11.    private static final long serialVersionUID = 5920926903803293709L;
  12.  
  13.    public Dialog(Frame var1) {
  14.       this(var1, "", false);
  15.    }
  16.  
  17.    public Dialog(Frame var1, boolean var2) {
  18.       this(var1, "", var2);
  19.    }
  20.  
  21.    public Dialog(Frame var1, String var2) {
  22.       this(var1, var2, false);
  23.    }
  24.  
  25.    public Dialog(Frame var1, String var2, boolean var3) {
  26.       super(var1);
  27.       this.resizable = true;
  28.       if (var1 == null) {
  29.          throw new IllegalArgumentException("null parent frame");
  30.       } else {
  31.          this.title = var2;
  32.          this.modal = var3;
  33.       }
  34.    }
  35.  
  36.    String constructComponentName() {
  37.       return "dialog" + nameCounter++;
  38.    }
  39.  
  40.    public void addNotify() {
  41.       Object var1 = ((Component)this).getTreeLock();
  42.       synchronized(var1){}
  43.  
  44.       try {
  45.          if (super.peer == null) {
  46.             super.peer = ((Window)this).getToolkit().createDialog(this);
  47.          }
  48.  
  49.          super.addNotify();
  50.       } catch (Throwable var3) {
  51.          throw var3;
  52.       }
  53.  
  54.    }
  55.  
  56.    public boolean isModal() {
  57.       return this.modal;
  58.    }
  59.  
  60.    public void setModal(boolean var1) {
  61.       this.modal = var1;
  62.    }
  63.  
  64.    public String getTitle() {
  65.       return this.title;
  66.    }
  67.  
  68.    public synchronized void setTitle(String var1) {
  69.       this.title = var1;
  70.       DialogPeer var2 = (DialogPeer)super.peer;
  71.       if (var2 != null) {
  72.          var2.setTitle(var1);
  73.       }
  74.  
  75.    }
  76.  
  77.    public void show() {
  78.       Object var1 = ((Component)this).getTreeLock();
  79.       synchronized(var1){}
  80.  
  81.       try {
  82.          if (super.parent != null && super.parent.getPeer() == null) {
  83.             super.parent.addNotify();
  84.          }
  85.  
  86.          if (super.peer == null) {
  87.             this.addNotify();
  88.          }
  89.       } catch (Throwable var3) {
  90.          throw var3;
  91.       }
  92.  
  93.       ((Container)this).validate();
  94.       if (super.visible) {
  95.          ((Window)this).toFront();
  96.       } else {
  97.          super.visible = true;
  98.          if (this.isModal()) {
  99.             EventDispatchThread var4 = null;
  100.             if (Thread.currentThread() instanceof EventDispatchThread) {
  101.                var4 = new EventDispatchThread("AWT-Dispatch-Proxy", Toolkit.getEventQueue());
  102.                ((Thread)var4).start();
  103.             }
  104.  
  105.             if ((super.state & 1) == 0) {
  106.                ((Window)this).postWindowEvent(200);
  107.                super.state |= 1;
  108.             }
  109.  
  110.             super.peer.show();
  111.             if (var4 != null) {
  112.                var4.stopDispatching();
  113.                return;
  114.             }
  115.          } else {
  116.             super.peer.show();
  117.             if ((super.state & 1) == 0) {
  118.                ((Window)this).postWindowEvent(200);
  119.                super.state |= 1;
  120.             }
  121.          }
  122.  
  123.       }
  124.    }
  125.  
  126.    public boolean isResizable() {
  127.       return this.resizable;
  128.    }
  129.  
  130.    public synchronized void setResizable(boolean var1) {
  131.       this.resizable = var1;
  132.       DialogPeer var2 = (DialogPeer)super.peer;
  133.       if (var2 != null) {
  134.          var2.setResizable(var1);
  135.       }
  136.  
  137.    }
  138.  
  139.    protected String paramString() {
  140.       String var1 = super.paramString() + (this.modal ? ",modal" : ",modeless");
  141.       if (this.title != null) {
  142.          var1 = var1 + ",title=" + this.title;
  143.       }
  144.  
  145.       return var1;
  146.    }
  147. }
  148.