home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 January / PCO0198.ISO / 1&1 / java.z / java_301 / sun / awt / windows / WDialogPeer.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-10-20  |  2.7 KB  |  103 lines

  1. package sun.awt.windows;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Dialog;
  5. import java.awt.Event;
  6. import java.awt.peer.DialogPeer;
  7.  
  8. class WDialogPeer extends WWindowPeer implements DialogPeer {
  9.    boolean notify = false;
  10.  
  11.    native void create(WComponentPeer var1);
  12.  
  13.    public native void setTitle(String var1);
  14.  
  15.    public native void setResizable(boolean var1);
  16.  
  17.    public native void showModal(boolean var1);
  18.  
  19.    public native void hideModal();
  20.  
  21.    WDialogPeer(Dialog target) {
  22.       super(target);
  23.       if (target.getTitle() != null) {
  24.          this.setTitle(target.getTitle());
  25.       }
  26.  
  27.       this.setResizable(target.isResizable());
  28.    }
  29.  
  30.    public void dispose() {
  31.       this.hide();
  32.       super.dispose();
  33.    }
  34.  
  35.    public void show() {
  36.       if (((Dialog)super.target).isModal()) {
  37.          if (((WToolkit)((WComponentPeer)this).getToolkit()).getCallbackThread() == Thread.currentThread()) {
  38.             this.showModal(true);
  39.          } else {
  40.             this.showModal(false);
  41.             Component var1 = super.target;
  42.             synchronized(var1){}
  43.  
  44.             try {
  45.                this.notify = true;
  46.  
  47.                try {
  48.                   super.target.wait(0L);
  49.                } catch (InterruptedException var4) {
  50.                }
  51.             } catch (Throwable var5) {
  52.                throw var5;
  53.             }
  54.  
  55.          }
  56.       } else {
  57.          super.show();
  58.       }
  59.    }
  60.  
  61.    public void hide() {
  62.       if (((Dialog)super.target).isModal()) {
  63.          if (this.notify) {
  64.             Component var1 = super.target;
  65.             synchronized(var1){}
  66.  
  67.             try {
  68.                this.notify = false;
  69.  
  70.                try {
  71.                   super.target.notifyAll();
  72.                } catch (IllegalMonitorStateException var4) {
  73.                }
  74.             } catch (Throwable var5) {
  75.                throw var5;
  76.             }
  77.          }
  78.  
  79.          this.hideModal();
  80.       } else {
  81.          super.hide();
  82.       }
  83.    }
  84.  
  85.    public synchronized void handleMoved(long when, int data, int x, int y) {
  86.       super.target.postEvent(new Event(super.target, 0L, 205, x, y, 0, 0));
  87.    }
  88.  
  89.    public void handleIconify(long when) {
  90.       super.target.postEvent(new Event(super.target, 203, (Object)null));
  91.    }
  92.  
  93.    public void handleDeiconify(long when) {
  94.       super.target.postEvent(new Event(super.target, 204, (Object)null));
  95.    }
  96.  
  97.    protected void handleResize(long when, int u1, int width, int height, int u4, int u5) {
  98.       super.target.invalidate();
  99.       super.target.validate();
  100.       super.target.repaint();
  101.    }
  102. }
  103.