50 |
*/ |
*/ |
51 |
public class Frame extends Window implements MenuContainer |
public class Frame extends Window implements MenuContainer |
52 |
{ |
{ |
|
|
|
|
/* |
|
|
* Static Variables |
|
|
*/ |
|
|
|
|
53 |
/** |
/** |
54 |
* Constant for the default cursor. |
* Constant for the default cursor. |
55 |
* @deprecated Replaced by <code>Cursor.DEFAULT_CURSOR</code> instead. |
* @deprecated Replaced by <code>Cursor.DEFAULT_CURSOR</code> instead. |
143 |
// Serialization version constant |
// Serialization version constant |
144 |
private static final long serialVersionUID = 2673458971256075116L; |
private static final long serialVersionUID = 2673458971256075116L; |
145 |
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/* |
|
|
* Instance Variables |
|
|
*/ |
|
|
|
|
146 |
/** |
/** |
147 |
* @serial The version of the class data being serialized |
* @serial The version of the class data being serialized |
148 |
* // FIXME: what is this value? |
* // FIXME: what is this value? |
197 |
*/ |
*/ |
198 |
private boolean undecorated = false; |
private boolean undecorated = false; |
199 |
|
|
|
/*************************************************************************/ |
|
|
|
|
200 |
/* |
/* |
201 |
* Constructors |
* The number used to generate the name returned by getName. |
202 |
*/ |
*/ |
203 |
|
private static transient long next_frame_number = 0; |
204 |
|
|
205 |
/** |
/** |
206 |
* Initializes a new instance of <code>Frame</code> that is not visible |
* Initializes a new instance of <code>Frame</code> that is not visible |
212 |
this(""); |
this(""); |
213 |
} |
} |
214 |
|
|
|
/*************************************************************************/ |
|
|
|
|
215 |
/** |
/** |
216 |
* Initializes a new instance of <code>Frame</code> that is not visible |
* Initializes a new instance of <code>Frame</code> that is not visible |
217 |
* and has the specified title. |
* and has the specified title. |
242 |
visible = false; |
visible = false; |
243 |
} |
} |
244 |
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/* |
|
|
* Instance Methods |
|
|
*/ |
|
|
|
|
245 |
/** |
/** |
246 |
* Returns this frame's title string. |
* Returns this frame's title string. |
247 |
* |
* |
253 |
return(title); |
return(title); |
254 |
} |
} |
255 |
|
|
|
/*************************************************************************/ |
|
|
|
|
256 |
/* |
/* |
257 |
* Sets this frame's title to the specified value. |
* Sets this frame's title to the specified value. |
258 |
* |
* |
266 |
((FramePeer) peer).setTitle(title); |
((FramePeer) peer).setTitle(title); |
267 |
} |
} |
268 |
|
|
|
/*************************************************************************/ |
|
|
|
|
269 |
/** |
/** |
270 |
* Returns this frame's icon. |
* Returns this frame's icon. |
271 |
* |
* |
278 |
return(icon); |
return(icon); |
279 |
} |
} |
280 |
|
|
|
/*************************************************************************/ |
|
|
|
|
281 |
/** |
/** |
282 |
* Sets this frame's icon to the specified value. |
* Sets this frame's icon to the specified value. |
283 |
* |
* |
291 |
((FramePeer) peer).setIconImage(icon); |
((FramePeer) peer).setIconImage(icon); |
292 |
} |
} |
293 |
|
|
|
/*************************************************************************/ |
|
|
|
|
294 |
/** |
/** |
295 |
* Returns this frame's menu bar. |
* Returns this frame's menu bar. |
296 |
* |
* |
303 |
return(menuBar); |
return(menuBar); |
304 |
} |
} |
305 |
|
|
|
/*************************************************************************/ |
|
|
|
|
306 |
/** |
/** |
307 |
* Sets this frame's menu bar. |
* Sets this frame's menu bar. |
308 |
* |
* |
322 |
this.menuBar = menuBar; |
this.menuBar = menuBar; |
323 |
} |
} |
324 |
|
|
|
/*************************************************************************/ |
|
|
|
|
325 |
/** |
/** |
326 |
* Tests whether or not this frame is resizable. This will be |
* Tests whether or not this frame is resizable. This will be |
327 |
* <code>true</code> by default. |
* <code>true</code> by default. |
335 |
return(resizable); |
return(resizable); |
336 |
} |
} |
337 |
|
|
|
/*************************************************************************/ |
|
|
|
|
338 |
/** |
/** |
339 |
* Sets the resizability of this frame to the specified value. |
* Sets the resizability of this frame to the specified value. |
340 |
* |
* |
349 |
((FramePeer) peer).setResizable(resizable); |
((FramePeer) peer).setResizable(resizable); |
350 |
} |
} |
351 |
|
|
|
/*************************************************************************/ |
|
|
|
|
352 |
/** |
/** |
353 |
* Returns the cursor type of the cursor for this window. This will |
* Returns the cursor type of the cursor for this window. This will |
354 |
* be one of the constants in this class. |
* be one of the constants in this class. |
363 |
return(getCursor().getType()); |
return(getCursor().getType()); |
364 |
} |
} |
365 |
|
|
|
/*************************************************************************/ |
|
|
|
|
366 |
/** |
/** |
367 |
* Sets the cursor for this window to the specified type. The specified |
* Sets the cursor for this window to the specified type. The specified |
368 |
* type should be one of the constants in this class. |
* type should be one of the constants in this class. |
377 |
setCursor(new Cursor(type)); |
setCursor(new Cursor(type)); |
378 |
} |
} |
379 |
|
|
|
/*************************************************************************/ |
|
|
|
|
380 |
/** |
/** |
381 |
* Removes the specified component from this frame's menu. |
* Removes the specified component from this frame's menu. |
382 |
* |
* |
388 |
menuBar.remove(menu); |
menuBar.remove(menu); |
389 |
} |
} |
390 |
|
|
|
/*************************************************************************/ |
|
|
|
|
391 |
/** |
/** |
392 |
* Notifies this frame that it should create its native peer. |
* Notifies this frame that it should create its native peer. |
393 |
*/ |
*/ |
408 |
super.removeNotify(); |
super.removeNotify(); |
409 |
} |
} |
410 |
|
|
|
/*************************************************************************/ |
|
|
|
|
411 |
/** |
/** |
412 |
* Returns a debugging string describing this window. |
* Returns a debugging string describing this window. |
413 |
* |
* |
414 |
* @return A debugging string describing this window. |
* @return A debugging string describing this window. |
415 |
*/ |
*/ |
416 |
protected String |
protected String paramString () |
|
paramString() |
|
417 |
{ |
{ |
418 |
return(getClass().getName()); |
String title = getTitle (); |
419 |
|
|
420 |
|
String resizable = ""; |
421 |
|
if (isResizable ()) |
422 |
|
resizable = ",resizable"; |
423 |
|
|
424 |
|
String state = ""; |
425 |
|
switch (getState ()) |
426 |
|
{ |
427 |
|
case NORMAL: |
428 |
|
state = ",normal"; |
429 |
|
break; |
430 |
|
case ICONIFIED: |
431 |
|
state = ",iconified"; |
432 |
|
break; |
433 |
|
case MAXIMIZED_BOTH: |
434 |
|
state = ",maximized-both"; |
435 |
|
break; |
436 |
|
case MAXIMIZED_HORIZ: |
437 |
|
state = ",maximized-horiz"; |
438 |
|
break; |
439 |
|
case MAXIMIZED_VERT: |
440 |
|
state = ",maximized-vert"; |
441 |
|
break; |
442 |
|
} |
443 |
|
|
444 |
|
return super.paramString () + ",title=" + title + resizable + state; |
445 |
} |
} |
446 |
|
|
447 |
public static Frame[] |
public static Frame[] |
534 |
|
|
535 |
this.undecorated = undecorated; |
this.undecorated = undecorated; |
536 |
} |
} |
|
} // class Frame |
|
537 |
|
|
538 |
|
/** |
539 |
|
* Generate a unique name for this frame. |
540 |
|
* |
541 |
|
* @return A unique name for this frame. |
542 |
|
*/ |
543 |
|
String generateName () |
544 |
|
{ |
545 |
|
return "frame" + getUniqueLong (); |
546 |
|
} |
547 |
|
|
548 |
|
private static synchronized long getUniqueLong () |
549 |
|
{ |
550 |
|
return next_frame_number++; |
551 |
|
} |
552 |
|
} |