home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 January / PCO0198.ISO / browser / net_linx / java40.jar / sun / awt / motif / MWindowPeer.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-11-03  |  2.6 KB  |  113 lines

  1. package sun.awt.motif;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Event;
  6. import java.awt.Font;
  7. import java.awt.Insets;
  8. import java.awt.Window;
  9. import java.awt.peer.WindowPeer;
  10. import java.util.Vector;
  11.  
  12. class MWindowPeer extends MPanelPeer implements WindowPeer {
  13.    Insets insets = new Insets(0, 0, 0, 0);
  14.    static Vector allWindows = new Vector();
  15.  
  16.    native void create(MComponentPeer var1);
  17.  
  18.    native void pShow();
  19.  
  20.    native void pHide();
  21.  
  22.    native void pReshape(int var1, int var2, int var3, int var4);
  23.  
  24.    native void pDispose();
  25.  
  26.    MWindowPeer(Window var1) {
  27.       super(var1);
  28.       allWindows.addElement(this);
  29.       MFramePeer var2 = (MFramePeer)((Component)var1).getParent().getPeer();
  30.       if (var2 != null) {
  31.          var2.addWindow(var1);
  32.       }
  33.  
  34.       Font var3 = ((Component)var1).getFont();
  35.       if (var3 == null) {
  36.          var3 = new Font("Dialog", 0, 12);
  37.          ((Component)var1).setFont(var3);
  38.          ((MComponentPeer)this).setFont(var3);
  39.       }
  40.  
  41.       Color var4 = ((Component)var1).getBackground();
  42.       if (var4 == null) {
  43.          ((Component)var1).setBackground(Color.lightGray);
  44.          ((MComponentPeer)this).setBackground(Color.lightGray);
  45.       }
  46.  
  47.       var4 = ((Component)var1).getForeground();
  48.       if (var4 == null) {
  49.          ((Component)var1).setForeground(Color.black);
  50.          ((MComponentPeer)this).setForeground(Color.black);
  51.       }
  52.  
  53.    }
  54.  
  55.    public void dispose() {
  56.       MFramePeer var1 = (MFramePeer)super.target.getParent().getPeer();
  57.       if (var1 != null) {
  58.          var1.removeWindow((Window)super.target);
  59.       }
  60.  
  61.       allWindows.removeElement(this);
  62.       super.dispose();
  63.    }
  64.  
  65.    public void toFront() {
  66.       this.pShow();
  67.    }
  68.  
  69.    public native void toBack();
  70.  
  71.    public Insets insets() {
  72.       return this.insets;
  73.    }
  74.  
  75.    public void handleQuit() {
  76.       if (super.applet != null) {
  77.          XEvent var1 = new XEvent(new Event(super.target, 201, (Object)null), this);
  78.          super.applet.sendEvent(var1);
  79.       } else {
  80.          super.target.postEvent(new Event(super.target, 201, (Object)null));
  81.       }
  82.    }
  83.  
  84.    public void handleIconify() {
  85.       if (super.applet != null) {
  86.          XEvent var1 = new XEvent(new Event(super.target, 203, (Object)null), this);
  87.          super.applet.sendEvent(var1);
  88.       } else {
  89.          super.target.postEvent(new Event(super.target, 203, (Object)null));
  90.       }
  91.    }
  92.  
  93.    public void handleDeiconify() {
  94.       if (super.applet != null) {
  95.          XEvent var1 = new XEvent(new Event(super.target, 204, (Object)null), this);
  96.          super.applet.sendEvent(var1);
  97.       } else {
  98.          super.target.postEvent(new Event(super.target, 204, (Object)null));
  99.       }
  100.    }
  101.  
  102.    public synchronized void handleResize(int var1, int var2) {
  103.       if (super.applet != null) {
  104.          XEvent var3 = new XEvent(new Event(super.target, 207, (Object)null), this);
  105.          super.applet.sendEvent(var3);
  106.       } else {
  107.          super.target.invalidate();
  108.          super.target.validate();
  109.          super.target.repaint();
  110.       }
  111.    }
  112. }
  113.