home *** CD-ROM | disk | FTP | other *** search
/ PC User 1998 October / Image.iso / BROWSER / CLASSES.ZIP / sun / AWT / WIN32 / MFramePeer.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-04-14  |  2.9 KB  |  131 lines

  1. package sun.awt.win32;
  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.Frame;
  8. import java.awt.Image;
  9. import java.awt.Insets;
  10. import java.awt.MenuBar;
  11. import java.awt.peer.FramePeer;
  12. import java.util.Vector;
  13. import sun.awt.image.ImageRepresentation;
  14.  
  15. class MFramePeer extends MPanelPeer implements FramePeer {
  16.    Insets insets = new Insets(0, 0, 0, 0);
  17.    static Vector allFrames = new Vector();
  18.  
  19.    native void create(MComponentPeer var1);
  20.  
  21.    native void pSetTitle(String var1);
  22.  
  23.    native void pShow();
  24.  
  25.    native void pHide();
  26.  
  27.    native void pReshape(int var1, int var2, int var3, int var4);
  28.  
  29.    native void pDispose();
  30.  
  31.    native void pSetIconImage(ImageRepresentation var1);
  32.  
  33.    native void setInsets(Insets var1);
  34.  
  35.    public native void setResizable(boolean var1);
  36.  
  37.    MFramePeer(Frame var1) {
  38.       super(var1);
  39.       this.setInsets(this.insets);
  40.       allFrames.addElement(this);
  41.       if (var1.getTitle() != null) {
  42.          this.pSetTitle(var1.getTitle());
  43.       }
  44.  
  45.       Font var2 = ((Component)var1).getFont();
  46.       if (var2 == null) {
  47.          var2 = new Font("Dialog", 0, 12);
  48.          ((Component)var1).setFont(var2);
  49.          ((MComponentPeer)this).setFont(var2);
  50.       }
  51.  
  52.       Color var3 = ((Component)var1).getBackground();
  53.       if (var3 == null) {
  54.          var3 = new Color(this.getWindowBackgroundColor());
  55.          ((Component)var1).setBackground(var3);
  56.          ((MComponentPeer)this).setBackground(var3);
  57.       }
  58.  
  59.       var3 = ((Component)var1).getForeground();
  60.       if (var3 == null) {
  61.          ((Component)var1).setForeground(Color.black);
  62.          ((MComponentPeer)this).setForeground(Color.black);
  63.       }
  64.  
  65.       Image var4 = var1.getIconImage();
  66.       if (var4 != null) {
  67.          this.setIconImage(var4);
  68.       }
  69.  
  70.       if (var1.getCursorType() != 0) {
  71.          this.setCursor(var1.getCursorType());
  72.       }
  73.  
  74.       this.setResizable(var1.isResizable());
  75.    }
  76.  
  77.    public void setTitle(String var1) {
  78.       this.pSetTitle(var1);
  79.    }
  80.  
  81.    public void dispose() {
  82.       allFrames.removeElement(this);
  83.       super.dispose();
  84.    }
  85.  
  86.    public void setIconImage(Image var1) {
  87.       ImageRepresentation var2 = ((Win32Image)var1).getImageRep(-1, -1);
  88.       var2.reconstruct(32);
  89.       this.pSetIconImage(var2);
  90.    }
  91.  
  92.    public native void setMenuBar(MenuBar var1);
  93.  
  94.    public void handleQuit() {
  95.       super.target.postEvent(new Event(super.target, 201, (Object)null));
  96.    }
  97.  
  98.    public void handleIconify() {
  99.       super.target.postEvent(new Event(super.target, 203, (Object)null));
  100.    }
  101.  
  102.    public void handleDeiconify() {
  103.       super.target.postEvent(new Event(super.target, 204, (Object)null));
  104.    }
  105.  
  106.    public void toFront() {
  107.       ((MComponentPeer)this).show();
  108.    }
  109.  
  110.    public void toBack() {
  111.    }
  112.  
  113.    public synchronized void handleMoved(int var1, int var2) {
  114.       super.target.postEvent(new Event(super.target, 0L, 205, var1, var2, 0, 0));
  115.    }
  116.  
  117.    public synchronized void handleResize(int var1, int var2) {
  118.       super.target.invalidate();
  119.       super.target.validate();
  120.       super.target.repaint();
  121.    }
  122.  
  123.    public Insets insets() {
  124.       return this.insets;
  125.    }
  126.  
  127.    public native void setCursor(int var1);
  128.  
  129.    public native int getWindowBackgroundColor();
  130. }
  131.