Changeset 1391 for branches/GNU/src/gcc/libjava/java/awt/Window.java
- Timestamp:
- Apr 27, 2004, 8:39:34 PM (22 years ago)
- Location:
- branches/GNU/src/gcc
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
libjava/java/awt/Window.java (modified) (20 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/gcc
- Property svn:ignore
-
old new 26 26 configure.vr 27 27 configure.vrs 28 28 29 Makefile 29 dir.info30 30 lost+found 31 31 update.out
-
- Property svn:ignore
-
branches/GNU/src/gcc/libjava/java/awt/Window.java
-
Property cvs2svn:cvs-rev
changed from
1.1to1.1.1.2
r1390 r1391 1 /* Copyright (C) 1999, 2000, 2002 Free Software Foundation 2 3 Copyright (C) 1999 Free Software Foundation, Inc. 1 /* Window.java -- 2 Copyright (C) 1999, 2000, 2002 Free Software Foundation 4 3 5 4 This file is part of GNU Classpath. … … 37 36 exception statement from your version. */ 38 37 38 39 39 package java.awt; 40 40 41 import java.awt.event.WindowEvent; 41 42 import java.awt.event.WindowListener; … … 86 87 * 87 88 * @param parent The owning <code>Frame</code> of this window. 89 90 91 92 88 93 */ 89 94 public Window(Frame owner) 90 95 { 91 this((Window) owner); 92 } 93 94 /** @since 1.2 */ 96 this (owner, owner.getGraphicsConfiguration ()); 97 } 98 99 /** 100 * Initializes a new instance of <code>Window</code> with the specified 101 * parent. The window will initially be invisible. 102 * 103 * @exception IllegalArgumentException If the owner's GraphicsConfiguration 104 * is not from a screen device, or if owner is null; this exception is always 105 * thrown when GraphicsEnvironment.isHeadless returns true. 106 * 107 * @since 1.2 108 */ 95 109 public Window(Window owner) 96 110 { 97 this(); 111 this (owner, owner.getGraphicsConfiguration ()); 112 } 113 114 /** 115 * Initializes a new instance of <code>Window</code> with the specified 116 * parent. The window will initially be invisible. 117 * 118 * @exception IllegalArgumentException If owner is null or if gc is not from a 119 * screen device; this exception is always thrown when 120 * GraphicsEnvironment.isHeadless returns true. 121 * 122 * @since 1.3 123 */ 124 public Window(Window owner, GraphicsConfiguration gc) 125 { 126 this (); 127 98 128 if (owner == null) 99 throw new IllegalArgumentException("owner must not be null"); 129 throw new IllegalArgumentException ("owner must not be null"); 130 131 this.parent = owner; 100 132 101 this.parent = owner;102 103 133 // FIXME: add to owner's "owned window" list 104 134 //owner.owned.add(this); // this should be a weak reference 105 } 106 107 /** @since 1.3 */ 108 public Window(Window owner, GraphicsConfiguration gc) 109 { 110 this(owner); 111 135 112 136 /* FIXME: Security check 113 137 SecurityManager.checkTopLevelWindow(...) 138 114 139 115 140 if (gc != null … … 119 144 if (gc == null) 120 145 graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment() 121 .getDefaultScreenDevice()122 .getDefaultConfiguration();146 .getDefaultScreenDevice() 147 .getDefaultConfiguration(); 123 148 else 124 */ 125 graphicsConfiguration = gc; 149 graphicsConfiguration = gc; 126 150 } 127 151 … … 134 158 } 135 159 160 161 162 163 164 165 136 166 protected void finalize() throws Throwable 137 167 { … … 146 176 { 147 177 if (peer == null) 148 peer = getToolkit ().createWindow(this);149 super.addNotify ();178 peer = getToolkit(this); 179 super.addNotify(); 150 180 } 151 181 … … 158 188 public void pack() 159 189 { 160 if (parent != null 161 && !parent.isDisplayable()) 190 if (parent != null && !parent.isDisplayable()) 162 191 parent.addNotify(); 163 192 if (peer == null) … … 165 194 166 195 setSize(getPreferredSize()); 167 196 168 197 validate(); 169 198 } … … 172 201 * Makes this window visible and brings it to the front. 173 202 */ 174 public void show () 175 { 203 public void show() 204 { 205 if (parent != null && !parent.isDisplayable()) 206 parent.addNotify(); 176 207 if (peer == null) 177 208 addNotify(); 178 209 210 179 211 super.show(); 180 212 toFront(); … … 183 215 public void hide() 184 216 { 185 // FIXME: call hide() on a my "owned" children here.217 // FIXME: call hide() on ay "owned" children here. 186 218 super.hide(); 219 220 221 222 223 224 225 187 226 } 188 227 … … 207 246 * front of it. 208 247 */ 209 public void toBack ()248 public void toBack() 210 249 { 211 250 if (peer != null) 212 251 { 213 252 WindowPeer wp = (WindowPeer) peer; 214 wp.toBack ();253 wp.toBack(); 215 254 } 216 255 } … … 220 259 * any other windows. 221 260 */ 222 public void toFront ()261 public void toFront() 223 262 { 224 263 if (peer != null) 225 264 { 226 WindowPeer wp = (WindowPeer) peer;227 wp.toFront();265 WindowPeer wp = (WindowPeer) peer; 266 (); 228 267 } 229 268 } … … 239 278 public Toolkit getToolkit() 240 279 { 241 return Toolkit.getDefaultToolkit ();280 return Toolkit.getDefaultToolkit(); 242 281 } 243 282 … … 256 295 { 257 296 if (warningString != null) 258 return warningString;259 else260 {261 String warning = System.getProperty("awt.appletWarning");262 return warning;263 }297 return warningString; 298 else 299 { 300 String warning = System.getProperty("awt.appletWarning"); 301 return warning; 302 } 264 303 } 265 304 return null; … … 271 310 * @return The locale this window is configured for. 272 311 */ 273 public Locale getLocale ()274 { 275 return locale == null ? Locale.getDefault () : locale;312 public Locale getLocale() 313 { 314 return locale == null ? Locale.getDefault() : locale; 276 315 } 277 316 … … 313 352 * @param listener The <code>WindowListener</code> to add. 314 353 */ 315 public synchronized void addWindowListener (WindowListener listener)316 { 317 windowListener = AWTEventMulticaster.add (windowListener, listener);354 public synchronized void addWindowListener(WindowListener listener) 355 { 356 windowListener = AWTEventMulticaster.add(windowListener, listener); 318 357 } 319 358 … … 324 363 * @param listener The <code>WindowListener</code> to remove. 325 364 */ 326 public synchronized void removeWindowListener (WindowListener listener) 327 { 328 windowListener = AWTEventMulticaster.remove (windowListener, listener); 329 } 330 331 /** @since 1.3 */ 365 public synchronized void removeWindowListener(WindowListener listener) 366 { 367 windowListener = AWTEventMulticaster.remove(windowListener, listener); 368 } 369 370 /** 371 * Returns an array of all the window listeners registered on this window. 372 * 373 * @since 1.4 374 */ 375 public synchronized WindowListener[] getWindowListeners() 376 { 377 return (WindowListener[]) 378 AWTEventMulticaster.getListeners(windowListener, 379 WindowListener.class); 380 } 381 382 /** 383 * Returns an array of all the objects currently registered as FooListeners 384 * upon this Window. FooListeners are registered using the addFooListener 385 * method. 386 * 387 * @exception ClassCastException If listenerType doesn't specify a class or 388 * interface that implements java.util.EventListener. 389 * 390 * @since 1.3 391 */ 332 392 public EventListener[] getListeners(Class listenerType) 333 393 { 334 394 if (listenerType == WindowListener.class) 335 return get ListenersImpl(listenerType, windowListener);336 elsereturn super.getListeners(listenerType);395 return get); 396 return super.getListeners(listenerType); 337 397 } 338 398 … … 357 417 * @param event The event to process. 358 418 */ 359 protected void processEvent (AWTEvent evt)419 protected void processEvent(AWTEvent evt) 360 420 { 361 421 if (evt instanceof WindowEvent) 362 processWindowEvent ((WindowEvent) evt);422 processWindowEvent((WindowEvent) evt); 363 423 else 364 super.processEvent (evt);424 super.processEvent(evt); 365 425 } 366 426 … … 373 433 * @param event The event to process. 374 434 */ 375 protected void processWindowEvent (WindowEvent evt)435 protected void processWindowEvent(WindowEvent evt) 376 436 { 377 437 if (windowListener != null) 378 438 { 379 switch (evt.getID ())439 switch (evt.getID()) 380 440 { 381 441 case WindowEvent.WINDOW_ACTIVATED: 382 windowListener.windowActivated (evt);442 windowListener.windowActivated(evt); 383 443 break; 384 444 case WindowEvent.WINDOW_CLOSED: 385 windowListener.windowClosed (evt);445 windowListener.windowClosed(evt); 386 446 break; 387 447 case WindowEvent.WINDOW_CLOSING: 388 windowListener.windowClosing (evt);448 windowListener.windowClosing(evt); 389 449 break; 390 450 case WindowEvent.WINDOW_DEACTIVATED: 391 windowListener.windowDeactivated (evt);451 windowListener.windowDeactivated(evt); 392 452 break; 393 453 case WindowEvent.WINDOW_DEICONIFIED: 394 windowListener.windowDeiconified (evt);454 windowListener.windowDeiconified(evt); 395 455 break; 396 456 case WindowEvent.WINDOW_ICONIFIED: 397 windowListener.windowIconified (evt);457 windowListener.windowIconified(evt); 398 458 break; 399 459 case WindowEvent.WINDOW_OPENED: 400 windowListener.windowOpened (evt);460 windowListener.windowOpened(evt); 401 461 break; 402 462 } … … 472 532 return null; 473 533 } 474 475 534 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
