home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / rt.jar / java / awt / Dialog.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-23  |  3.1 KB  |  137 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.          super.name = "dialog" + nameCounter++;
  32.          this.title = var2;
  33.          this.modal = var3;
  34.       }
  35.    }
  36.  
  37.    public void addNotify() {
  38.       if (super.peer == null) {
  39.          super.peer = ((Window)this).getToolkit().createDialog(this);
  40.       }
  41.  
  42.       super.addNotify();
  43.    }
  44.  
  45.    public boolean isModal() {
  46.       return this.modal;
  47.    }
  48.  
  49.    public void setModal(boolean var1) {
  50.       this.modal = var1;
  51.    }
  52.  
  53.    public String getTitle() {
  54.       return this.title;
  55.    }
  56.  
  57.    public synchronized void setTitle(String var1) {
  58.       this.title = var1;
  59.       DialogPeer var2 = (DialogPeer)super.peer;
  60.       if (var2 != null) {
  61.          var2.setTitle(var1);
  62.       }
  63.  
  64.    }
  65.  
  66.    public void show() {
  67.       Object var1 = ((Component)this).getTreeLock();
  68.       synchronized(var1){}
  69.  
  70.       try {
  71.          if (super.parent != null && super.parent.getPeer() == null) {
  72.             super.parent.addNotify();
  73.          }
  74.  
  75.          if (super.peer == null) {
  76.             this.addNotify();
  77.          }
  78.       } catch (Throwable var3) {
  79.          throw var3;
  80.       }
  81.  
  82.       ((Container)this).validate();
  83.       if (super.visible) {
  84.          ((Window)this).toFront();
  85.       } else {
  86.          super.visible = true;
  87.          if (this.isModal()) {
  88.             EventDispatchThread var4 = null;
  89.             if (Thread.currentThread() instanceof EventDispatchThread) {
  90.                var4 = new EventDispatchThread("AWT-Dispatch-Proxy", Toolkit.getEventQueue());
  91.                ((Thread)var4).start();
  92.             }
  93.  
  94.             if ((super.state & 1) == 0) {
  95.                ((Window)this).postWindowEvent(200);
  96.                super.state |= 1;
  97.             }
  98.  
  99.             super.peer.show();
  100.             if (var4 != null) {
  101.                var4.stopDispatching();
  102.                return;
  103.             }
  104.          } else {
  105.             super.peer.show();
  106.             if ((super.state & 1) == 0) {
  107.                ((Window)this).postWindowEvent(200);
  108.                super.state |= 1;
  109.             }
  110.          }
  111.  
  112.       }
  113.    }
  114.  
  115.    public boolean isResizable() {
  116.       return this.resizable;
  117.    }
  118.  
  119.    public synchronized void setResizable(boolean var1) {
  120.       this.resizable = var1;
  121.       DialogPeer var2 = (DialogPeer)super.peer;
  122.       if (var2 != null) {
  123.          var2.setResizable(var1);
  124.       }
  125.  
  126.    }
  127.  
  128.    protected String paramString() {
  129.       String var1 = super.paramString() + (this.modal ? ",modal" : ",modeless");
  130.       if (this.title != null) {
  131.          var1 = var1 + ",title=" + this.title;
  132.       }
  133.  
  134.       return var1;
  135.    }
  136. }
  137.