home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 June / CHIPHEFT062001.ISO / browser / nc32lyc / comm.z / java40.jar / sun / awt / motif / MWindowPeer.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-08-15  |  2.2 KB  |  86 lines

  1. package sun.awt.motif;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Font;
  6. import java.awt.Insets;
  7. import java.awt.Window;
  8. import java.awt.event.ComponentEvent;
  9. import java.awt.event.WindowEvent;
  10. import java.awt.peer.WindowPeer;
  11. import java.util.Vector;
  12.  
  13. class MWindowPeer extends MPanelPeer implements WindowPeer {
  14.    Insets insets = new Insets(0, 0, 0, 0);
  15.    static Vector allWindows = new Vector();
  16.  
  17.    native void create(MComponentPeer var1);
  18.  
  19.    native void pShow();
  20.  
  21.    native void pHide();
  22.  
  23.    native void pReshape(int var1, int var2, int var3, int var4);
  24.  
  25.    native void pDispose();
  26.  
  27.    MWindowPeer(Window var1) {
  28.       super(var1);
  29.       allWindows.addElement(this);
  30.       Font var2 = ((Component)var1).getFont();
  31.       if (var2 == null) {
  32.          var2 = new Font("Dialog", 0, 12);
  33.          ((Component)var1).setFont(var2);
  34.          ((MComponentPeer)this).setFont(var2);
  35.       }
  36.  
  37.       Color var3 = ((Component)var1).getBackground();
  38.       if (var3 == null) {
  39.          ((Component)var1).setBackground(Color.lightGray);
  40.          ((MComponentPeer)this).setBackground(Color.lightGray);
  41.       }
  42.  
  43.       var3 = ((Component)var1).getForeground();
  44.       if (var3 == null) {
  45.          ((Component)var1).setForeground(Color.black);
  46.          ((MComponentPeer)this).setForeground(Color.black);
  47.       }
  48.  
  49.    }
  50.  
  51.    public void dispose() {
  52.       allWindows.removeElement(this);
  53.       super.dispose();
  54.    }
  55.  
  56.    public void toFront() {
  57.       this.pShow();
  58.    }
  59.  
  60.    public native void toBack();
  61.  
  62.    public Insets getInsets() {
  63.       return this.insets;
  64.    }
  65.  
  66.    public void handleQuit() {
  67.       ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 201));
  68.    }
  69.  
  70.    public void handleIconify() {
  71.       ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 203));
  72.    }
  73.  
  74.    public void handleDeiconify() {
  75.       ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 204));
  76.    }
  77.  
  78.    public synchronized void handleResize(int var1, int var2) {
  79.       ((MComponentPeer)this).postEvent(new ComponentEvent(super.target, 101));
  80.    }
  81.  
  82.    public Insets insets() {
  83.       return this.getInsets();
  84.    }
  85. }
  86.