home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 June / pcx11_9706.iso / shutils / internet / browser / p32e40b5.exe / nav40.z / java40.jar / sun / awt / motif / MFramePeer.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-05-23  |  4.1 KB  |  199 lines

  1. package sun.awt.motif;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Dialog;
  6. import java.awt.Event;
  7. import java.awt.Font;
  8. import java.awt.Frame;
  9. import java.awt.Image;
  10. import java.awt.Insets;
  11. import java.awt.MenuBar;
  12. import java.awt.Rectangle;
  13. import java.awt.Window;
  14. import java.awt.peer.FramePeer;
  15. import java.util.Vector;
  16. import sun.awt.image.ImageRepresentation;
  17.  
  18. class MFramePeer extends MPanelPeer implements FramePeer {
  19.    Insets insets;
  20.    Vector dialogList = new Vector();
  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.    MFramePeer(Frame var1) {
  40.       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)));
  41.       allFrames.addElement(this);
  42.       if (var1.getTitle() != null) {
  43.          this.pSetTitle(var1.getTitle());
  44.       }
  45.  
  46.       Font var2 = ((Component)var1).getFont();
  47.       if (var2 == null) {
  48.          var2 = new Font("Dialog", 0, 12);
  49.          ((Component)var1).setFont(var2);
  50.          ((MComponentPeer)this).setFont(var2);
  51.       }
  52.  
  53.       Color var3 = ((Component)var1).getBackground();
  54.       if (var3 == null) {
  55.          ((Component)var1).setBackground(Color.lightGray);
  56.          ((MComponentPeer)this).setBackground(Color.lightGray);
  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.       Vector var1 = this.dialogList;
  83.       synchronized(var1){}
  84.  
  85.       try {
  86.          while(!this.dialogList.isEmpty()) {
  87.             Dialog var3 = (Dialog)this.dialogList.firstElement();
  88.             ((Window)var3).dispose();
  89.          }
  90.       } catch (Throwable var5) {
  91.          throw var5;
  92.       }
  93.  
  94.       allFrames.removeElement(this);
  95.       super.dispose();
  96.    }
  97.  
  98.    public void setIconImage(Image var1) {
  99.       ImageRepresentation var2 = ((X11Image)var1).getImageRep(-1, -1);
  100.       var2.reconstruct(32);
  101.       this.pSetIconImage(var2);
  102.    }
  103.  
  104.    public void setMenuBar(MenuBar var1) {
  105.       this.pSetMenuBar(var1);
  106.       if (super.target.isVisible()) {
  107.          Rectangle var2 = super.target.bounds();
  108.          this.pReshape(var2.x, var2.y, var2.width, var2.height);
  109.          super.target.invalidate();
  110.          super.target.validate();
  111.       }
  112.  
  113.    }
  114.  
  115.    native void pSetMenuBar(MenuBar var1);
  116.  
  117.    public void handleQuit() {
  118.       if (super.applet != null) {
  119.          XEvent var1 = new XEvent(new Event(super.target, 201, (Object)null), this);
  120.          super.applet.sendGUIEvent(var1);
  121.       } else {
  122.          super.target.postEvent(new Event(super.target, 201, (Object)null));
  123.       }
  124.    }
  125.  
  126.    public void handleIconify() {
  127.       if (super.applet != null) {
  128.          XEvent var1 = new XEvent(new Event(super.target, 203, (Object)null), this);
  129.          super.applet.sendGUIEvent(var1);
  130.       } else {
  131.          super.target.postEvent(new Event(super.target, 203, (Object)null));
  132.       }
  133.    }
  134.  
  135.    public void handleDeiconify() {
  136.       if (super.applet != null) {
  137.          XEvent var1 = new XEvent(new Event(super.target, 204, (Object)null), this);
  138.          super.applet.sendGUIEvent(var1);
  139.       } else {
  140.          super.target.postEvent(new Event(super.target, 204, (Object)null));
  141.       }
  142.    }
  143.  
  144.    public void toFront() {
  145.       this.pShow();
  146.    }
  147.  
  148.    public native void toBack();
  149.  
  150.    public synchronized void handleMoved(int var1, int var2) {
  151.       if (super.applet != null) {
  152.          XEvent var3 = new XEvent(new Event(super.target, 0L, 205, var1, var2, 0, 0), this);
  153.          super.applet.sendGUIEvent(var3);
  154.       } else {
  155.          super.target.postEvent(new Event(super.target, 0L, 205, var1, var2, 0, 0));
  156.       }
  157.    }
  158.  
  159.    public synchronized void handleResize(int var1, int var2) {
  160.       super.target.invalidate();
  161.       super.target.validate();
  162.       super.target.repaint();
  163.    }
  164.  
  165.    public Insets insets() {
  166.       return this.insets;
  167.    }
  168.  
  169.    public native void setCursor(int var1);
  170.  
  171.    public void addDialog(Dialog var1) {
  172.       Vector var2 = this.dialogList;
  173.       synchronized(var2){}
  174.  
  175.       try {
  176.          if (var1 != null) {
  177.             this.dialogList.addElement(var1);
  178.          }
  179.       } catch (Throwable var4) {
  180.          throw var4;
  181.       }
  182.  
  183.    }
  184.  
  185.    public void removeDialog(Dialog var1) {
  186.       Vector var2 = this.dialogList;
  187.       synchronized(var2){}
  188.  
  189.       try {
  190.          if (var1 != null) {
  191.             this.dialogList.removeElement(var1);
  192.          }
  193.       } catch (Throwable var4) {
  194.          throw var4;
  195.       }
  196.  
  197.    }
  198. }
  199.