home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 June / CHIPHEFT062001.ISO / browser / nc32lyc / comm.z / java40.jar / sun / awt / motif / MFramePeer.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-08-15  |  4.4 KB  |  169 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.Frame;
  7. import java.awt.Graphics;
  8. import java.awt.Image;
  9. import java.awt.Insets;
  10. import java.awt.MenuBar;
  11. import java.awt.Rectangle;
  12. import java.awt.Window;
  13. import java.awt.event.ComponentEvent;
  14. import java.awt.event.WindowEvent;
  15. import java.awt.peer.FramePeer;
  16. import java.util.Vector;
  17. import sun.awt.image.ImageRepresentation;
  18.  
  19. class MFramePeer extends MPanelPeer implements FramePeer {
  20.    Insets insets;
  21.    static Vector allFrames = new Vector();
  22.  
  23.    native void create(MComponentPeer var1, Object var2);
  24.  
  25.    native void pSetTitle(String var1);
  26.  
  27.    native void pShow();
  28.  
  29.    native void pHide();
  30.  
  31.    native void pReshape(int var1, int var2, int var3, int var4);
  32.  
  33.    native void pDispose();
  34.  
  35.    native void pSetIconImage(ImageRepresentation var1);
  36.  
  37.    public native void setResizable(boolean var1);
  38.  
  39.    native void addTextComponent();
  40.  
  41.    MFramePeer(Frame var1) {
  42.       super(var1, new Insets(Integer.getInteger("awt.frame.topInset", 25), Integer.getInteger("awt.frame.leftInset", 5), Integer.getInteger("awt.frame.bottomInset", 5), Integer.getInteger("awt.frame.rightInset", 5)));
  43.       allFrames.addElement(this);
  44.       if (var1.getTitle() != null) {
  45.          this.pSetTitle(var1.getTitle());
  46.       }
  47.  
  48.       Font var2 = ((Component)var1).getFont();
  49.       if (var2 == null) {
  50.          var2 = new Font("Dialog", 0, 12);
  51.          ((Component)var1).setFont(var2);
  52.          ((MComponentPeer)this).setFont(var2);
  53.       }
  54.  
  55.       Color var3 = ((Component)var1).getBackground();
  56.       if (var3 == null) {
  57.          ((Component)var1).setBackground(Color.lightGray);
  58.          ((MComponentPeer)this).setBackground(Color.lightGray);
  59.       }
  60.  
  61.       var3 = ((Component)var1).getForeground();
  62.       if (var3 == null) {
  63.          ((Component)var1).setForeground(Color.black);
  64.          ((MComponentPeer)this).setForeground(Color.black);
  65.       }
  66.  
  67.       Image var4 = var1.getIconImage();
  68.       if (var4 != null) {
  69.          this.setIconImage(var4);
  70.       }
  71.  
  72.       this.setResizable(var1.isResizable());
  73.    }
  74.  
  75.    public void setTitle(String var1) {
  76.       this.pSetTitle(var1);
  77.    }
  78.  
  79.    public void dispose() {
  80.       allFrames.removeElement(this);
  81.       super.dispose();
  82.    }
  83.  
  84.    public void setIconImage(Image var1) {
  85.       ImageRepresentation var2 = ((X11Image)var1).getImageRep();
  86.       var2.reconstruct(32);
  87.       this.pSetIconImage(var2);
  88.    }
  89.  
  90.    public void setMenuBar(MenuBar var1) {
  91.       MMenuBarPeer var2 = (MMenuBarPeer)MToolkit.targetToPeer(var1);
  92.       this.pSetMenuBar(var2);
  93.       if (super.target.isVisible()) {
  94.          Rectangle var3 = super.target.bounds();
  95.          this.pReshape(var3.x, var3.y, var3.width, var3.height);
  96.          super.target.invalidate();
  97.          super.target.validate();
  98.       }
  99.  
  100.    }
  101.  
  102.    native void pSetMenuBar(MMenuBarPeer var1);
  103.  
  104.    public void handleActivate() {
  105.       ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 205));
  106.    }
  107.  
  108.    public void handleDeactivate() {
  109.       ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 206));
  110.    }
  111.  
  112.    public void handleQuit() {
  113.       ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 201));
  114.    }
  115.  
  116.    public void handleIconify() {
  117.       ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 203));
  118.    }
  119.  
  120.    public void handleDeiconify() {
  121.       ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 204));
  122.    }
  123.  
  124.    public void toFront() {
  125.       this.pShow();
  126.    }
  127.  
  128.    public native void toBack();
  129.  
  130.    public synchronized void handleMoved(int var1, int var2) {
  131.       ((MComponentPeer)this).postEvent(new ComponentEvent(super.target, 100));
  132.    }
  133.  
  134.    public synchronized void handleResize(int var1, int var2) {
  135.       ((MComponentPeer)this).postEvent(new ComponentEvent(super.target, 101));
  136.    }
  137.  
  138.    public Insets getInsets() {
  139.       return this.insets;
  140.    }
  141.  
  142.    public void print(Graphics var1) {
  143.       super.print(var1);
  144.       Frame var2 = (Frame)super.target;
  145.       MenuBar var3 = var2.getMenuBar();
  146.       if (var3 != null) {
  147.          MMenuBarPeer var4 = (MMenuBarPeer)MToolkit.targetToPeer(var3);
  148.          if (var4 != null) {
  149.             Insets var5 = this.insets();
  150.             Graphics var6 = var1.create();
  151.  
  152.             try {
  153.                var6.translate(var5.left, 24);
  154.                var4.print(var6);
  155.             } finally {
  156.                var6.dispose();
  157.             }
  158.  
  159.             return;
  160.          }
  161.       }
  162.  
  163.    }
  164.  
  165.    public Insets insets() {
  166.       return this.getInsets();
  167.    }
  168. }
  169.