1 Clazz.declarePackage ("java.awt");
\r
2 Clazz.load (["java.awt.Window"], "java.awt.Frame", ["java.lang.IllegalArgumentException", "java.awt.Cursor", "$.IllegalComponentStateException"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
4 this.maximizedBounds = null;
\r
5 this.title = "Untitled";
\r
6 this.resizable = true;
\r
7 this.undecorated = false;
\r
8 this.mbManagement = false;
\r
10 this.ownedWindows = null;
\r
11 this.menuBar = null;
\r
12 Clazz.instantialize (this, arguments);
\r
13 }, java.awt, "Frame", java.awt.Window);
\r
14 Clazz.makeConstructor (c$,
\r
16 this.construct ("");
\r
18 Clazz.makeConstructor (c$,
\r
20 this.construct ("", gc);
\r
21 }, "java.awt.GraphicsConfiguration");
\r
22 Clazz.makeConstructor (c$,
\r
24 Clazz.superConstructor (this, java.awt.Frame, []);
\r
25 this.initFrame (title, null);
\r
27 Clazz.makeConstructor (c$,
\r
28 function (title, gc) {
\r
29 Clazz.superConstructor (this, java.awt.Frame, [gc]);
\r
30 this.initFrame (title, gc);
\r
31 }, "~S,java.awt.GraphicsConfiguration");
\r
32 Clazz.defineMethod (c$, "initFrame",
\r
33 function (title, gc) {
\r
35 }, "~S,java.awt.GraphicsConfiguration");
\r
36 Clazz.overrideMethod (c$, "constructComponentName",
\r
39 return "frame" + java.awt.Frame.$nameCounter++;
\r
41 Clazz.defineMethod (c$, "addNotify",
\r
43 if (this.peer == null) {
\r
44 this.peer = this.getToolkit ().createFrame (this);
\r
46 p.setMaximizedBounds (this.maximizedBounds);
\r
47 Clazz.superCall (this, java.awt.Frame, "addNotify", []);
\r
49 Clazz.defineMethod (c$, "getTitle",
\r
53 Clazz.defineMethod (c$, "setTitle",
\r
55 var oldTitle = this.title;
\r
56 if (title == null) {
\r
60 }this.firePropertyChangeObject ("title", oldTitle, title);
\r
62 Clazz.defineMethod (c$, "getIconImage",
\r
64 var icons = this.icons;
\r
65 if (icons != null) {
\r
66 if (icons.size () > 0) {
\r
67 return icons.get (0);
\r
70 Clazz.defineMethod (c$, "isResizable",
\r
72 return this.resizable;
\r
74 Clazz.defineMethod (c$, "setResizable",
\r
75 function (resizable) {
\r
76 var oldResizable = this.resizable;
\r
78 this.resizable = resizable;
\r
79 }this.firePropertyChangeBool ("resizable", oldResizable, resizable);
\r
81 Clazz.defineMethod (c$, "setState",
\r
83 var current = this.getExtendedState ();
\r
84 if (state == 1 && (current & 1) == 0) {
\r
85 this.setExtendedState (current | 1);
\r
86 } else if (state == 0 && (current & 1) != 0) {
\r
87 this.setExtendedState (current & -2);
\r
89 Clazz.defineMethod (c$, "setExtendedState",
\r
91 if (!this.isFrameStateSupported (state)) {
\r
93 }this.$state = state;
\r
95 Clazz.defineMethod (c$, "isFrameStateSupported",
\r
97 if (!this.getToolkit ().isFrameStateSupported (state)) {
\r
98 if (((state & 1) != 0) && !this.getToolkit ().isFrameStateSupported (1)) {
\r
102 }return this.getToolkit ().isFrameStateSupported (state);
\r
105 Clazz.defineMethod (c$, "getState",
\r
107 return (this.getExtendedState () & 1) != 0 ? 1 : 0;
\r
109 Clazz.defineMethod (c$, "getExtendedState",
\r
111 return this.$state;
\r
113 Clazz.defineMethod (c$, "setMaximizedBounds",
\r
114 function (bounds) {
\r
115 this.maximizedBounds = bounds;
\r
116 }, "java.awt.Rectangle");
\r
117 Clazz.defineMethod (c$, "getMaximizedBounds",
\r
119 return this.maximizedBounds;
\r
121 Clazz.defineMethod (c$, "setUndecorated",
\r
122 function (undecorated) {
\r
124 if (this.isDisplayable ()) {
\r
125 throw new java.awt.IllegalComponentStateException ("The frame is displayable.");
\r
126 }this.undecorated = undecorated;
\r
128 Clazz.defineMethod (c$, "isUndecorated",
\r
130 return this.undecorated;
\r
132 Clazz.overrideMethod (c$, "removeNotify",
\r
135 Clazz.defineMethod (c$, "paramString",
\r
137 var str = Clazz.superCall (this, java.awt.Frame, "paramString", []);
\r
138 if (this.title != null) {
\r
139 str += ",title=" + this.title;
\r
140 }if (this.resizable) {
\r
141 str += ",resizable";
\r
142 }this.getExtendedState ();
\r
143 if (this.$state == 0) {
\r
146 if ((this.$state & 1) != 0) {
\r
147 str += ",iconified";
\r
148 }if ((this.$state & 6) == 6) {
\r
149 str += ",maximized";
\r
150 } else if ((this.$state & 2) != 0) {
\r
151 str += ",maximized_horiz";
\r
152 } else if ((this.$state & 4) != 0) {
\r
153 str += ",maximized_vert";
\r
156 Clazz.defineMethod (c$, "setCursor",
\r
157 function (cursorType) {
\r
158 if (cursorType < 0 || cursorType > 13) {
\r
159 throw new IllegalArgumentException ("illegal cursor type");
\r
160 }this.setCursor (java.awt.Cursor.getPredefinedCursor (cursorType));
\r
162 Clazz.defineMethod (c$, "getCursorType",
\r
164 return (this.getCursor ().getType ());
\r
166 c$.getFrames = Clazz.defineMethod (c$, "getFrames",
\r
168 var allWindows = java.awt.Window.getWindows ();
\r
169 var frameCount = 0;
\r
170 for (var w, $w = 0, $$w = allWindows; $w < $$w.length && ((w = $$w[$w]) || true); $w++) {
\r
171 if (Clazz.instanceOf (w, java.awt.Frame)) {
\r
174 var frames = new Array (frameCount);
\r
176 for (var w, $w = 0, $$w = allWindows; $w < $$w.length && ((w = $$w[$w]) || true); $w++) {
\r
177 if (Clazz.instanceOf (w, java.awt.Frame)) {
\r
182 Clazz.defineStatics (c$,
\r
183 "DEFAULT_CURSOR", 0,
\r
184 "CROSSHAIR_CURSOR", 1,
\r
187 "SW_RESIZE_CURSOR", 4,
\r
188 "SE_RESIZE_CURSOR", 5,
\r
189 "NW_RESIZE_CURSOR", 6,
\r
190 "NE_RESIZE_CURSOR", 7,
\r
191 "N_RESIZE_CURSOR", 8,
\r
192 "S_RESIZE_CURSOR", 9,
\r
193 "W_RESIZE_CURSOR", 10,
\r
194 "E_RESIZE_CURSOR", 11,
\r
199 "MAXIMIZED_HORIZ", 2,
\r
200 "MAXIMIZED_VERT", 4,
\r
201 "MAXIMIZED_BOTH", 6,
\r
203 "$nameCounter", 0);
\r