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.util.Vector;
-
- 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;
- String title;
- Image icon;
- MenuBar menuBar;
- boolean resizable;
- boolean mbManagement;
- Vector ownedWindows;
- private static final String base = "frame";
- private static int nameCounter;
- private static final long serialVersionUID = 2673458971256075116L;
- private int frameSerializedDataVersion;
-
- public Frame() {
- this("");
- }
-
- public Frame(String var1) {
- this.title = "Untitled";
- this.resizable = true;
- this.mbManagement = false;
- this.frameSerializedDataVersion = 1;
- super.name = "frame" + nameCounter++;
- this.title = var1;
- super.visible = false;
- ((Container)this).setLayout(new BorderLayout());
- }
-
- Window addOwnedWindow(Window var1) {
- if (var1 != null) {
- if (this.ownedWindows == null) {
- this.ownedWindows = new Vector();
- }
-
- this.ownedWindows.addElement(var1);
- }
-
- return var1;
- }
-
- void removeOwnedWindow(Window var1) {
- if (var1 != null && this.ownedWindows != null) {
- this.ownedWindows.removeElement(var1);
- }
-
- }
-
- public void addNotify() {
- Object var1 = ((Component)this).getTreeLock();
- synchronized(var1){}
-
- try {
- if (super.peer == null) {
- super.peer = ((Window)this).getToolkit().createFrame(this);
- }
-
- MenuBar var3 = this.menuBar;
- if (var3 != null) {
- var3.addNotify();
- ((FramePeer)super.peer).setMenuBar(var3);
- }
-
- super.addNotify();
- } catch (Throwable var5) {
- throw var5;
- }
-
- }
-
- 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){}
-
- try {
- 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 var4 = (FramePeer)super.peer;
- if (var4 != null) {
- this.mbManagement = true;
- this.menuBar.addNotify();
- var4.setMenuBar(this.menuBar);
- }
- }
-
- ((Container)this).invalidate();
- return;
- }
- } catch (Throwable var6) {
- throw var6;
- }
-
- }
-
- public boolean isResizable() {
- return this.resizable;
- }
-
- public synchronized void setResizable(boolean var1) {
- this.resizable = var1;
- FramePeer var2 = (FramePeer)super.peer;
- if (var2 != null) {
- var2.setResizable(var1);
- }
-
- }
-
- public void remove(MenuComponent var1) {
- Object var2 = ((Component)this).getTreeLock();
- synchronized(var2){}
-
- try {
- if (var1 == this.menuBar) {
- FramePeer var4 = (FramePeer)super.peer;
- if (var4 != null) {
- this.mbManagement = true;
- this.menuBar.removeNotify();
- var4.setMenuBar((MenuBar)null);
- }
-
- this.menuBar.parent = null;
- this.menuBar = null;
- } else {
- super.remove(var1);
- }
- } catch (Throwable var6) {
- throw var6;
- }
-
- }
-
- public void dispose() {
- Object var1 = ((Component)this).getTreeLock();
- synchronized(var1){}
-
- try {
- if (this.ownedWindows != null) {
- int var3 = this.ownedWindows.size();
- Window[] var4 = new Window[var3];
- this.ownedWindows.copyInto(var4);
-
- for(int var5 = 0; var5 < var3; ++var5) {
- var4[var5].dispose();
- }
- }
-
- if (this.menuBar != null) {
- this.remove(this.menuBar);
- this.menuBar = null;
- }
- } catch (Throwable var7) {
- throw var7;
- }
-
- super.dispose();
- }
-
- 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;
- }
-
- /** @deprecated */
- public synchronized void setCursor(int var1) {
- if (var1 >= 0 && var1 <= 13) {
- ((Component)this).setCursor(Cursor.getPredefinedCursor(var1));
- } else {
- throw new IllegalArgumentException("illegal cursor type");
- }
- }
-
- /** @deprecated */
- public int getCursorType() {
- return ((Component)this).getCursor().getType();
- }
-
- 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 var3 = (Window)this.ownedWindows.elementAt(var2);
- var3.parent = this;
- }
- }
-
- }
- }
-