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

  1. package sun.awt.windows;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Font;
  6. import java.awt.Window;
  7. import java.awt.peer.WindowPeer;
  8. import java.util.Vector;
  9.  
  10. class WWindowPeer extends WContainerPeer implements WindowPeer {
  11.    static Vector allWindows = new Vector();
  12.  
  13.    native void create(WComponentPeer var1);
  14.  
  15.    public void toFront() {
  16.       ((WComponentPeer)this).show();
  17.    }
  18.  
  19.    public native void toBack();
  20.  
  21.    WWindowPeer(Window target) {
  22.       super(target);
  23.       allWindows.addElement(this);
  24.       Font f = ((Component)target).getFont();
  25.       if (f == null) {
  26.          f = new Font("Dialog", 0, 12);
  27.          ((Component)target).setFont(f);
  28.          ((WComponentPeer)this).setFont(f);
  29.       }
  30.  
  31.       Color c = ((Component)target).getBackground();
  32.       if (c == null) {
  33.          ((Component)target).setBackground(Color.lightGray);
  34.          ((WComponentPeer)this).setBackground(Color.lightGray);
  35.       }
  36.  
  37.       c = ((Component)target).getForeground();
  38.       if (c == null) {
  39.          ((Component)target).setForeground(Color.black);
  40.          ((WComponentPeer)this).setForeground(Color.black);
  41.       }
  42.  
  43.    }
  44.  
  45.    public void dispose() {
  46.       allWindows.removeElement(this);
  47.       super.dispose();
  48.    }
  49. }
  50.