home *** CD-ROM | disk | FTP | other *** search
- package java.awt;
-
- import java.awt.event.InputEvent;
- import java.awt.event.KeyEvent;
- import java.awt.peer.FramePeer;
- import java.io.IOException;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import java.lang.ref.WeakReference;
- import java.util.Vector;
- import javax.accessibility.AccessibleContext;
- import sun.awt.AppContext;
-
- public class Frame extends Window implements MenuContainer {
- public static final int DEFAULT_CURSOR = 0;
- public static final int CROSSHAIR_CURSOR = 1;
- public static final int TEXT_CURSOR = 2;
- public static final int WAIT_CURSOR = 3;
- public static final int SW_RESIZE_CURSOR = 4;
- public static final int SE_RESIZE_CURSOR = 5;
- public static final int NW_RESIZE_CURSOR = 6;
- public static final int NE_RESIZE_CURSOR = 7;
- public static final int N_RESIZE_CURSOR = 8;
- public static final int S_RESIZE_CURSOR = 9;
- public static final int W_RESIZE_CURSOR = 10;
- public static final int E_RESIZE_CURSOR = 11;
- public static final int HAND_CURSOR = 12;
- public static final int MOVE_CURSOR = 13;
- public static final int NORMAL = 0;
- public static final int ICONIFIED = 1;
- String title;
- Image icon;
- MenuBar menuBar;
- boolean resizable;
- boolean mbManagement;
- private int state;
- Vector ownedWindows;
- private transient WeakReference weakThis;
- private static final String base = "frame";
- private static int nameCounter = 0;
- private static final long serialVersionUID = 2673458971256075116L;
- private int frameSerializedDataVersion;
- // $FF: synthetic field
- static Class class$java$awt$Frame;
-
- public Frame() {
- this("", (GraphicsConfiguration)null);
- }
-
- public Frame(GraphicsConfiguration var1) {
- this("", var1);
- }
-
- public Frame(String var1) {
- this(var1, (GraphicsConfiguration)null);
- }
-
- public Frame(String var1, GraphicsConfiguration var2) {
- super(var2);
- this.title = "Untitled";
- this.resizable = true;
- this.mbManagement = false;
- this.state = 0;
- this.frameSerializedDataVersion = 1;
- this.title = var1;
- this.weakThis = new WeakReference(this);
- this.addToFrameList();
- }
-
- protected void finalize() throws Throwable {
- this.removeFromFrameList();
- super.finalize();
- }
-
- String constructComponentName() {
- Class var1 = this.getClass();
- synchronized(var1) {
- String var2 = "frame" + nameCounter++;
- return var2;
- }
- }
-
- public void addNotify() {
- Object var1 = ((Component)this).getTreeLock();
- synchronized(var1) {
- if (super.peer == null) {
- super.peer = ((Window)this).getToolkit().createFrame(this);
- }
-
- MenuBar var2 = this.menuBar;
- if (var2 != null) {
- this.mbManagement = true;
- var2.addNotify();
- ((FramePeer)super.peer).setMenuBar(var2);
- }
-
- super.addNotify();
- }
- }
-
- public String getTitle() {
- return this.title;
- }
-
- public synchronized void setTitle(String var1) {
- this.title = var1;
- FramePeer var2 = (FramePeer)super.peer;
- if (var2 != null) {
- var2.setTitle(var1);
- }
-
- }
-
- public Image getIconImage() {
- return this.icon;
- }
-
- public synchronized void setIconImage(Image var1) {
- this.icon = var1;
- FramePeer var2 = (FramePeer)super.peer;
- if (var2 != null) {
- var2.setIconImage(var1);
- }
-
- }
-
- public MenuBar getMenuBar() {
- return this.menuBar;
- }
-
- public void setMenuBar(MenuBar var1) {
- Object var2 = ((Component)this).getTreeLock();
- synchronized(var2) {
- if (this.menuBar != var1) {
- if (var1 != null && var1.parent != null) {
- var1.parent.remove(var1);
- }
-
- if (this.menuBar != null) {
- this.remove(this.menuBar);
- }
-
- this.menuBar = var1;
- if (this.menuBar != null) {
- this.menuBar.parent = this;
- FramePeer var3 = (FramePeer)super.peer;
- if (var3 != null) {
- this.mbManagement = true;
- this.menuBar.addNotify();
- if (super.valid) {
- ((Container)this).invalidate();
- }
-
- var3.setMenuBar(this.menuBar);
- }
- }
-
- }
- }
- }
-
- public boolean isResizable() {
- return this.resizable;
- }
-
- public void setResizable(boolean var1) {
- boolean var2 = false;
- synchronized(this) {
- this.resizable = var1;
- FramePeer var4 = (FramePeer)super.peer;
- if (var4 != null) {
- var4.setResizable(var1);
- var2 = true;
- }
- }
-
- if (var2 && super.valid) {
- ((Container)this).invalidate();
- }
-
- }
-
- public synchronized void setState(int var1) {
- this.state = var1;
- FramePeer var2 = (FramePeer)super.peer;
- if (var2 != null) {
- var2.setState(var1);
- }
-
- }
-
- public synchronized int getState() {
- FramePeer var1 = (FramePeer)super.peer;
- if (var1 != null) {
- this.state = var1.getState();
- }
-
- return this.state;
- }
-
- public void remove(MenuComponent var1) {
- Object var2 = ((Component)this).getTreeLock();
- synchronized(var2) {
- if (var1 == this.menuBar) {
- this.menuBar = null;
- FramePeer var3 = (FramePeer)super.peer;
- if (var3 != null) {
- this.mbManagement = true;
- if (super.valid) {
- ((Container)this).invalidate();
- }
-
- var3.setMenuBar((MenuBar)null);
- var1.removeNotify();
- }
-
- var1.parent = null;
- } else {
- super.remove(var1);
- }
-
- }
- }
-
- public void removeNotify() {
- Object var1 = ((Component)this).getTreeLock();
- synchronized(var1) {
- FramePeer var2 = (FramePeer)super.peer;
- if (var2 != null) {
- this.getState();
- if (this.menuBar != null) {
- this.mbManagement = true;
- var2.setMenuBar((MenuBar)null);
- this.menuBar.removeNotify();
- }
- }
-
- super.removeNotify();
- }
- }
-
- void postProcessKeyEvent(KeyEvent var1) {
- if (this.menuBar != null && this.menuBar.handleShortcut(var1)) {
- ((InputEvent)var1).consume();
- } else {
- super.postProcessKeyEvent(var1);
- }
- }
-
- protected String paramString() {
- String var1 = super.paramString();
- if (this.resizable) {
- var1 = var1 + ",resizable";
- }
-
- if (this.title != null) {
- var1 = var1 + ",title=" + this.title;
- }
-
- return var1;
- }
-
- public void setCursor(int var1) {
- if (var1 >= 0 && var1 <= 13) {
- ((Window)this).setCursor(Cursor.getPredefinedCursor(var1));
- } else {
- throw new IllegalArgumentException("illegal cursor type");
- }
- }
-
- public int getCursorType() {
- return ((Component)this).getCursor().getType();
- }
-
- public static Frame[] getFrames() {
- Class var0 = class$java$awt$Frame == null ? (class$java$awt$Frame = class$("java.awt.Frame")) : class$java$awt$Frame;
- synchronized(var0) {
- Vector var2 = (Vector)AppContext.getAppContext().get(class$java$awt$Frame == null ? (class$java$awt$Frame = class$("java.awt.Frame")) : class$java$awt$Frame);
- Frame[] var1;
- if (var2 != null) {
- int var3 = var2.size();
- int var4 = 0;
- Frame[] var5 = new Frame[var3];
-
- for(int var6 = 0; var6 < var3; ++var6) {
- var5[var4] = (Frame)((WeakReference)var2.elementAt(var6)).get();
- if (var5[var4] != null) {
- ++var4;
- }
- }
-
- if (var3 != var4) {
- var1 = new Frame[var4];
- System.arraycopy(var5, 0, var1, 0, var4);
- } else {
- var1 = var5;
- }
- } else {
- var1 = new Frame[0];
- }
-
- return var1;
- }
- }
-
- void addToFrameList() {
- Class var1 = class$java$awt$Frame == null ? (class$java$awt$Frame = class$("java.awt.Frame")) : class$java$awt$Frame;
- synchronized(var1) {
- Vector var2 = (Vector)super.appContext.get(class$java$awt$Frame == null ? (class$java$awt$Frame = class$("java.awt.Frame")) : class$java$awt$Frame);
- if (var2 == null) {
- var2 = new Vector();
- super.appContext.put(class$java$awt$Frame == null ? (class$java$awt$Frame = class$("java.awt.Frame")) : class$java$awt$Frame, var2);
- }
-
- var2.addElement(this.weakThis);
- }
- }
-
- void removeFromFrameList() {
- Class var1 = class$java$awt$Frame == null ? (class$java$awt$Frame = class$("java.awt.Frame")) : class$java$awt$Frame;
- synchronized(var1) {
- Vector var2 = (Vector)super.appContext.get(class$java$awt$Frame == null ? (class$java$awt$Frame = class$("java.awt.Frame")) : class$java$awt$Frame);
- if (var2 != null) {
- var2.removeElement(this.weakThis);
- }
-
- }
- }
-
- private void writeObject(ObjectOutputStream var1) throws IOException {
- var1.defaultWriteObject();
- }
-
- private void readObject(ObjectInputStream var1) throws ClassNotFoundException, IOException {
- var1.defaultReadObject();
- if (this.menuBar != null) {
- this.menuBar.parent = this;
- }
-
- if (this.ownedWindows != null) {
- for(int var2 = 0; var2 < this.ownedWindows.size(); ++var2) {
- ((Window)this).connectOwnedWindow((Window)this.ownedWindows.elementAt(var2));
- }
-
- this.ownedWindows = null;
- }
-
- this.weakThis = new WeakReference(this);
- this.addToFrameList();
- }
-
- private static native void initIDs();
-
- public AccessibleContext getAccessibleContext() {
- if (super.accessibleContext == null) {
- super.accessibleContext = new AccessibleAWTFrame(this);
- }
-
- return super.accessibleContext;
- }
-
- // $FF: synthetic method
- static Class class$(String var0) {
- try {
- return Class.forName(var0);
- } catch (ClassNotFoundException var2) {
- throw new NoClassDefFoundError(((Throwable)var2).getMessage());
- }
- }
-
- static {
- Toolkit.loadLibraries();
- initIDs();
- }
- }
-