home *** CD-ROM | disk | FTP | other *** search
- package sun.awt.motif;
-
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Event;
- import java.awt.Font;
- import java.awt.Frame;
- import java.awt.Image;
- import java.awt.Insets;
- import java.awt.MenuBar;
- import java.awt.Rectangle;
- import java.awt.Window;
- import java.awt.peer.FramePeer;
- import java.util.Vector;
- import sun.awt.image.ImageRepresentation;
-
- class MFramePeer extends MPanelPeer implements FramePeer {
- Insets insets;
- Vector windowList = new Vector();
- static Vector allFrames = new Vector();
-
- native void create(MComponentPeer var1, Object var2);
-
- native void pSetTitle(String var1);
-
- native void pShow();
-
- native void pHide();
-
- native void pReshape(int var1, int var2, int var3, int var4);
-
- native void pDispose();
-
- native void pSetIconImage(ImageRepresentation var1);
-
- public native void setResizable(boolean var1);
-
- MFramePeer(Frame var1) {
- 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)));
- allFrames.addElement(this);
- if (var1.getTitle() != null) {
- this.pSetTitle(var1.getTitle());
- }
-
- Font var2 = ((Component)var1).getFont();
- if (var2 == null) {
- var2 = new Font("Dialog", 0, 12);
- ((Component)var1).setFont(var2);
- ((MComponentPeer)this).setFont(var2);
- }
-
- Color var3 = ((Component)var1).getBackground();
- if (var3 == null) {
- ((Component)var1).setBackground(Color.lightGray);
- ((MComponentPeer)this).setBackground(Color.lightGray);
- }
-
- var3 = ((Component)var1).getForeground();
- if (var3 == null) {
- ((Component)var1).setForeground(Color.black);
- ((MComponentPeer)this).setForeground(Color.black);
- }
-
- Image var4 = var1.getIconImage();
- if (var4 != null) {
- this.setIconImage(var4);
- }
-
- if (var1.getCursorType() != 0) {
- this.setCursor(var1.getCursorType());
- }
-
- this.setResizable(var1.isResizable());
- }
-
- public void setTitle(String var1) {
- this.pSetTitle(var1);
- }
-
- public void dispose() {
- Vector var1 = this.windowList;
- synchronized(var1){}
-
- try {
- while(!this.windowList.isEmpty()) {
- Window var3 = (Window)this.windowList.firstElement();
- var3.dispose();
- }
- } catch (Throwable var5) {
- throw var5;
- }
-
- allFrames.removeElement(this);
- super.dispose();
- }
-
- public void setIconImage(Image var1) {
- ImageRepresentation var2 = ((X11Image)var1).getImageRep(-1, -1);
- var2.reconstruct(32);
- this.pSetIconImage(var2);
- }
-
- public void setMenuBar(MenuBar var1) {
- this.pSetMenuBar(var1);
- if (super.target.isVisible()) {
- Rectangle var2 = super.target.bounds();
- this.pReshape(var2.x, var2.y, var2.width, var2.height);
- super.target.invalidate();
- super.target.validate();
- }
-
- }
-
- native void pSetMenuBar(MenuBar var1);
-
- public void handleQuit() {
- if (super.applet != null) {
- XEvent var1 = new XEvent(new Event(super.target, 201, (Object)null), this);
- super.applet.sendEvent(var1);
- } else {
- super.target.postEvent(new Event(super.target, 201, (Object)null));
- }
- }
-
- public void handleIconify() {
- if (super.applet != null) {
- XEvent var1 = new XEvent(new Event(super.target, 203, (Object)null), this);
- super.applet.sendEvent(var1);
- } else {
- super.target.postEvent(new Event(super.target, 203, (Object)null));
- }
- }
-
- public void handleDeiconify() {
- if (super.applet != null) {
- XEvent var1 = new XEvent(new Event(super.target, 204, (Object)null), this);
- super.applet.sendEvent(var1);
- } else {
- super.target.postEvent(new Event(super.target, 204, (Object)null));
- }
- }
-
- public void toFront() {
- this.pShow();
- }
-
- public native void toBack();
-
- public synchronized void handleMoved(int var1, int var2) {
- if (super.applet != null) {
- XEvent var3 = new XEvent(new Event(super.target, 0L, 205, var1, var2, 0, 0), this);
- super.applet.sendEvent(var3);
- } else {
- super.target.postEvent(new Event(super.target, 0L, 205, var1, var2, 0, 0));
- }
- }
-
- public synchronized void handleResize(int var1, int var2) {
- if (super.applet != null) {
- XEvent var3 = new XEvent(new Event(super.target, 207, (Object)null), this);
- super.applet.sendEvent(var3);
- } else {
- super.target.invalidate();
- super.target.validate();
- super.target.repaint();
- }
- }
-
- public Insets insets() {
- return this.insets;
- }
-
- public native void setCursor(int var1);
-
- void addWindow(Window var1) {
- Vector var2 = this.windowList;
- synchronized(var2){}
-
- try {
- if (var1 != null) {
- this.windowList.addElement(var1);
- }
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
-
- void removeWindow(Window var1) {
- Vector var2 = this.windowList;
- synchronized(var2){}
-
- try {
- if (var1 != null) {
- this.windowList.removeElement(var1);
- }
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
- }
-