Print this page
Split |
Close |
Expand all |
Collapse all |
--- old/src/share/classes/javax/swing/JWindow.java
+++ new/src/share/classes/javax/swing/JWindow.java
1 1 /*
2 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation. Oracle designates this
8 8 * particular file as subject to the "Classpath" exception as provided
9 9 * by Oracle in the LICENSE file that accompanied this code.
10 10 *
11 11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 14 * version 2 for more details (a copy is included in the LICENSE file that
15 15 * accompanied this code).
16 16 *
17 17 * You should have received a copy of the GNU General Public License version
18 18 * 2 along with this work; if not, write to the Free Software Foundation,
19 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 20 *
21 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 22 * or visit www.oracle.com if you need additional information or have any
23 23 * questions.
24 24 */
25 25 package javax.swing;
26 26
27 27 import java.awt.*;
28 28 import java.awt.event.*;
29 29 import java.beans.PropertyChangeListener;
30 30 import java.util.Locale;
31 31 import java.util.Vector;
32 32 import java.io.Serializable;
33 33
34 34 import javax.accessibility.*;
35 35
36 36 /**
37 37 * A <code>JWindow</code> is a container that can be displayed anywhere on the
38 38 * user's desktop. It does not have the title bar, window-management buttons,
39 39 * or other trimmings associated with a <code>JFrame</code>, but it is still a
40 40 * "first-class citizen" of the user's desktop, and can exist anywhere
41 41 * on it.
42 42 * <p>
43 43 * The <code>JWindow</code> component contains a <code>JRootPane</code>
44 44 * as its only child. The <code>contentPane</code> should be the parent
45 45 * of any children of the <code>JWindow</code>.
46 46 * As a convenience, the {@code add}, {@code remove}, and {@code setLayout}
47 47 * methods of this class are overridden, so that they delegate calls
48 48 * to the corresponding methods of the {@code ContentPane}.
49 49 * For example, you can add a child component to a window as follows:
50 50 * <pre>
51 51 * window.add(child);
52 52 * </pre>
53 53 * And the child will be added to the contentPane.
54 54 * The <code>contentPane</code> will always be non-<code>null</code>.
55 55 * Attempting to set it to <code>null</code> will cause the <code>JWindow</code>
56 56 * to throw an exception. The default <code>contentPane</code> will have a
57 57 * <code>BorderLayout</code> manager set on it.
58 58 * Refer to {@link javax.swing.RootPaneContainer}
59 59 * for details on adding, removing and setting the <code>LayoutManager</code>
60 60 * of a <code>JWindow</code>.
61 61 * <p>
62 62 * Please see the {@link JRootPane} documentation for a complete description of
63 63 * the <code>contentPane</code>, <code>glassPane</code>, and
64 64 * <code>layeredPane</code> components.
65 65 * <p>
66 66 * In a multi-screen environment, you can create a <code>JWindow</code>
67 67 * on a different screen device. See {@link java.awt.Window} for more
68 68 * information.
69 69 * <p>
70 70 * <strong>Warning:</strong> Swing is not thread safe. For more
71 71 * information see <a
72 72 * href="package-summary.html#threading">Swing's Threading
73 73 * Policy</a>.
74 74 * <p>
75 75 * <strong>Warning:</strong>
76 76 * Serialized objects of this class will not be compatible with
77 77 * future Swing releases. The current serialization support is
78 78 * appropriate for short term storage or RMI between applications running
79 79 * the same version of Swing. As of 1.4, support for long term storage
80 80 * of all JavaBeans™
81 81 * has been added to the <code>java.beans</code> package.
82 82 * Please see {@link java.beans.XMLEncoder}.
83 83 *
84 84 * @see JRootPane
85 85 *
86 86 * @beaninfo
87 87 * attribute: isContainer true
88 88 * attribute: containerDelegate getContentPane
89 89 * description: A toplevel window which has no system border or controls.
90 90 *
91 91 * @author David Kloba
92 92 */
93 93 @SuppressWarnings("serial")
94 94 public class JWindow extends Window implements Accessible,
95 95 RootPaneContainer,
96 96 TransferHandler.HasGetTransferHandler
97 97 {
98 98 /**
99 99 * The <code>JRootPane</code> instance that manages the
100 100 * <code>contentPane</code>
101 101 * and optional <code>menuBar</code> for this frame, as well as the
102 102 * <code>glassPane</code>.
103 103 *
104 104 * @see #getRootPane
105 105 * @see #setRootPane
106 106 */
107 107 protected JRootPane rootPane;
108 108
109 109 /**
110 110 * If true then calls to <code>add</code> and <code>setLayout</code>
111 111 * will be forwarded to the <code>contentPane</code>. This is initially
112 112 * false, but is set to true when the <code>JWindow</code> is constructed.
113 113 *
114 114 * @see #isRootPaneCheckingEnabled
115 115 * @see #setRootPaneCheckingEnabled
116 116 * @see javax.swing.RootPaneContainer
117 117 */
118 118 protected boolean rootPaneCheckingEnabled = false;
119 119
120 120 /**
121 121 * The <code>TransferHandler</code> for this window.
122 122 */
123 123 private TransferHandler transferHandler;
124 124
125 125 /**
126 126 * Creates a window with no specified owner. This window will not be
127 127 * focusable.
128 128 * <p>
129 129 * This constructor sets the component's locale property to the value
130 130 * returned by <code>JComponent.getDefaultLocale</code>.
131 131 *
132 132 * @throws HeadlessException if
133 133 * <code>GraphicsEnvironment.isHeadless()</code> returns true.
134 134 * @see java.awt.GraphicsEnvironment#isHeadless
135 135 * @see #isFocusableWindow
136 136 * @see JComponent#getDefaultLocale
137 137 */
138 138 public JWindow() {
139 139 this((Frame)null);
140 140 }
141 141
142 142 /**
143 143 * Creates a window with the specified <code>GraphicsConfiguration</code>
144 144 * of a screen device. This window will not be focusable.
145 145 * <p>
146 146 * This constructor sets the component's locale property to the value
147 147 * returned by <code>JComponent.getDefaultLocale</code>.
148 148 *
149 149 * @param gc the <code>GraphicsConfiguration</code> that is used
150 150 * to construct the new window with; if gc is <code>null</code>,
151 151 * the system default <code>GraphicsConfiguration</code>
152 152 * is assumed
153 153 * @throws HeadlessException If
154 154 * <code>GraphicsEnvironment.isHeadless()</code> returns true.
155 155 * @throws IllegalArgumentException if <code>gc</code> is not from
156 156 * a screen device.
157 157 *
158 158 * @see java.awt.GraphicsEnvironment#isHeadless
159 159 * @see #isFocusableWindow
160 160 * @see JComponent#getDefaultLocale
161 161 *
162 162 * @since 1.3
163 163 */
164 164 public JWindow(GraphicsConfiguration gc) {
165 165 this(null, gc);
166 166 super.setFocusableWindowState(false);
167 167 }
168 168
169 169 /**
170 170 * Creates a window with the specified owner frame.
171 171 * If <code>owner</code> is <code>null</code>, the shared owner
172 172 * will be used and this window will not be focusable. Also,
173 173 * this window will not be focusable unless its owner is showing
174 174 * on the screen.
175 175 * <p>
176 176 * This constructor sets the component's locale property to the value
177 177 * returned by <code>JComponent.getDefaultLocale</code>.
178 178 *
179 179 * @param owner the frame from which the window is displayed
180 180 * @throws HeadlessException if GraphicsEnvironment.isHeadless()
181 181 * returns true.
182 182 * @see java.awt.GraphicsEnvironment#isHeadless
183 183 * @see #isFocusableWindow
184 184 * @see JComponent#getDefaultLocale
185 185 */
186 186 public JWindow(Frame owner) {
187 187 super(owner == null? SwingUtilities.getSharedOwnerFrame() : owner);
188 188 if (owner == null) {
189 189 WindowListener ownerShutdownListener =
190 190 SwingUtilities.getSharedOwnerFrameShutdownListener();
191 191 addWindowListener(ownerShutdownListener);
192 192 }
193 193 windowInit();
194 194 }
195 195
196 196 /**
197 197 * Creates a window with the specified owner window. This window
198 198 * will not be focusable unless its owner is showing on the screen.
199 199 * If <code>owner</code> is <code>null</code>, the shared owner
200 200 * will be used and this window will not be focusable.
201 201 * <p>
202 202 * This constructor sets the component's locale property to the value
203 203 * returned by <code>JComponent.getDefaultLocale</code>.
204 204 *
205 205 * @param owner the window from which the window is displayed
206 206 * @throws HeadlessException if
207 207 * <code>GraphicsEnvironment.isHeadless()</code> returns true.
208 208 * @see java.awt.GraphicsEnvironment#isHeadless
209 209 * @see #isFocusableWindow
210 210 * @see JComponent#getDefaultLocale
211 211 */
212 212 public JWindow(Window owner) {
213 213 super(owner == null ? (Window)SwingUtilities.getSharedOwnerFrame() :
214 214 owner);
215 215 if (owner == null) {
216 216 WindowListener ownerShutdownListener =
217 217 SwingUtilities.getSharedOwnerFrameShutdownListener();
218 218 addWindowListener(ownerShutdownListener);
219 219 }
220 220 windowInit();
221 221 }
222 222
223 223 /**
224 224 * Creates a window with the specified owner window and
225 225 * <code>GraphicsConfiguration</code> of a screen device. If
226 226 * <code>owner</code> is <code>null</code>, the shared owner will be used
227 227 * and this window will not be focusable.
228 228 * <p>
229 229 * This constructor sets the component's locale property to the value
230 230 * returned by <code>JComponent.getDefaultLocale</code>.
231 231 *
232 232 * @param owner the window from which the window is displayed
233 233 * @param gc the <code>GraphicsConfiguration</code> that is used
234 234 * to construct the new window with; if gc is <code>null</code>,
235 235 * the system default <code>GraphicsConfiguration</code>
236 236 * is assumed, unless <code>owner</code> is also null, in which
237 237 * case the <code>GraphicsConfiguration</code> from the
238 238 * shared owner frame will be used.
239 239 * @throws HeadlessException if
240 240 * <code>GraphicsEnvironment.isHeadless()</code> returns true.
241 241 * @throws IllegalArgumentException if <code>gc</code> is not from
242 242 * a screen device.
243 243 *
244 244 * @see java.awt.GraphicsEnvironment#isHeadless
245 245 * @see #isFocusableWindow
246 246 * @see JComponent#getDefaultLocale
247 247 *
248 248 * @since 1.3
249 249 */
250 250 public JWindow(Window owner, GraphicsConfiguration gc) {
251 251 super(owner == null ? (Window)SwingUtilities.getSharedOwnerFrame() :
252 252 owner, gc);
253 253 if (owner == null) {
254 254 WindowListener ownerShutdownListener =
255 255 SwingUtilities.getSharedOwnerFrameShutdownListener();
256 256 addWindowListener(ownerShutdownListener);
257 257 }
258 258 windowInit();
259 259 }
260 260
261 261 /**
262 262 * Called by the constructors to init the <code>JWindow</code> properly.
263 263 */
264 264 protected void windowInit() {
265 265 setLocale( JComponent.getDefaultLocale() );
266 266 setRootPane(createRootPane());
267 267 setRootPaneCheckingEnabled(true);
268 268 sun.awt.SunToolkit.checkAndSetPolicy(this);
269 269 }
270 270
271 271 /**
272 272 * Called by the constructor methods to create the default
273 273 * <code>rootPane</code>.
274 274 */
275 275 protected JRootPane createRootPane() {
276 276 JRootPane rp = new JRootPane();
277 277 // NOTE: this uses setOpaque vs LookAndFeel.installProperty as there
278 278 // is NO reason for the RootPane not to be opaque. For painting to
279 279 // work the contentPane must be opaque, therefor the RootPane can
280 280 // also be opaque.
281 281 rp.setOpaque(true);
282 282 return rp;
283 283 }
284 284
285 285 /**
286 286 * Returns whether calls to <code>add</code> and
287 287 * <code>setLayout</code> are forwarded to the <code>contentPane</code>.
288 288 *
289 289 * @return true if <code>add</code> and <code>setLayout</code>
290 290 * are forwarded; false otherwise
291 291 *
292 292 * @see #addImpl
293 293 * @see #setLayout
294 294 * @see #setRootPaneCheckingEnabled
295 295 * @see javax.swing.RootPaneContainer
296 296 */
297 297 protected boolean isRootPaneCheckingEnabled() {
298 298 return rootPaneCheckingEnabled;
299 299 }
300 300
301 301 /**
302 302 * Sets the {@code transferHandler} property, which is a mechanism to
303 303 * support transfer of data into this component. Use {@code null}
304 304 * if the component does not support data transfer operations.
305 305 * <p>
306 306 * If the system property {@code suppressSwingDropSupport} is {@code false}
307 307 * (the default) and the current drop target on this component is either
↓ open down ↓ |
307 lines elided |
↑ open up ↑ |
308 308 * {@code null} or not a user-set drop target, this method will change the
309 309 * drop target as follows: If {@code newHandler} is {@code null} it will
310 310 * clear the drop target. If not {@code null} it will install a new
311 311 * {@code DropTarget}.
312 312 * <p>
313 313 * Note: When used with {@code JWindow}, {@code TransferHandler} only
314 314 * provides data import capability, as the data export related methods
315 315 * are currently typed to {@code JComponent}.
316 316 * <p>
317 317 * Please see
318 - * <a href="http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">
318 + * <a href="https://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">
319 319 * How to Use Drag and Drop and Data Transfer</a>, a section in
320 320 * <em>The Java Tutorial</em>, for more information.
321 321 *
322 322 * @param newHandler the new {@code TransferHandler}
323 323 *
324 324 * @see TransferHandler
325 325 * @see #getTransferHandler
326 326 * @see java.awt.Component#setDropTarget
327 327 * @since 1.6
328 328 *
329 329 * @beaninfo
330 330 * bound: true
331 331 * hidden: true
332 332 * description: Mechanism for transfer of data into the component
333 333 */
334 334 public void setTransferHandler(TransferHandler newHandler) {
335 335 TransferHandler oldHandler = transferHandler;
336 336 transferHandler = newHandler;
337 337 SwingUtilities.installSwingDropTargetAsNecessary(this, transferHandler);
338 338 firePropertyChange("transferHandler", oldHandler, newHandler);
339 339 }
340 340
341 341 /**
342 342 * Gets the <code>transferHandler</code> property.
343 343 *
344 344 * @return the value of the <code>transferHandler</code> property
345 345 *
346 346 * @see TransferHandler
347 347 * @see #setTransferHandler
348 348 * @since 1.6
349 349 */
350 350 public TransferHandler getTransferHandler() {
351 351 return transferHandler;
352 352 }
353 353
354 354 /**
355 355 * Calls <code>paint(g)</code>. This method was overridden to
356 356 * prevent an unnecessary call to clear the background.
357 357 *
358 358 * @param g the <code>Graphics</code> context in which to paint
359 359 */
360 360 public void update(Graphics g) {
361 361 paint(g);
362 362 }
363 363
364 364 /**
365 365 * Sets whether calls to <code>add</code> and
366 366 * <code>setLayout</code> are forwarded to the <code>contentPane</code>.
367 367 *
368 368 * @param enabled true if <code>add</code> and <code>setLayout</code>
369 369 * are forwarded, false if they should operate directly on the
370 370 * <code>JWindow</code>.
371 371 *
372 372 * @see #addImpl
373 373 * @see #setLayout
374 374 * @see #isRootPaneCheckingEnabled
375 375 * @see javax.swing.RootPaneContainer
376 376 * @beaninfo
377 377 * hidden: true
378 378 * description: Whether the add and setLayout methods are forwarded
379 379 */
380 380 protected void setRootPaneCheckingEnabled(boolean enabled) {
381 381 rootPaneCheckingEnabled = enabled;
382 382 }
383 383
384 384
385 385 /**
386 386 * Adds the specified child <code>Component</code>.
387 387 * This method is overridden to conditionally forward calls to the
388 388 * <code>contentPane</code>.
389 389 * By default, children are added to the <code>contentPane</code> instead
390 390 * of the frame, refer to {@link javax.swing.RootPaneContainer} for
391 391 * details.
392 392 *
393 393 * @param comp the component to be enhanced
394 394 * @param constraints the constraints to be respected
395 395 * @param index the index
396 396 * @exception IllegalArgumentException if <code>index</code> is invalid
397 397 * @exception IllegalArgumentException if adding the container's parent
398 398 * to itself
399 399 * @exception IllegalArgumentException if adding a window to a container
400 400 *
401 401 * @see #setRootPaneCheckingEnabled
402 402 * @see javax.swing.RootPaneContainer
403 403 */
404 404 protected void addImpl(Component comp, Object constraints, int index)
405 405 {
406 406 if(isRootPaneCheckingEnabled()) {
407 407 getContentPane().add(comp, constraints, index);
408 408 }
409 409 else {
410 410 super.addImpl(comp, constraints, index);
411 411 }
412 412 }
413 413
414 414 /**
415 415 * Removes the specified component from the container. If
416 416 * <code>comp</code> is not the <code>rootPane</code>, this will forward
417 417 * the call to the <code>contentPane</code>. This will do nothing if
418 418 * <code>comp</code> is not a child of the <code>JWindow</code> or
419 419 * <code>contentPane</code>.
420 420 *
421 421 * @param comp the component to be removed
422 422 * @throws NullPointerException if <code>comp</code> is null
423 423 * @see #add
424 424 * @see javax.swing.RootPaneContainer
425 425 */
426 426 public void remove(Component comp) {
427 427 if (comp == rootPane) {
428 428 super.remove(comp);
429 429 } else {
430 430 getContentPane().remove(comp);
431 431 }
432 432 }
433 433
434 434
435 435 /**
436 436 * Sets the <code>LayoutManager</code>.
437 437 * Overridden to conditionally forward the call to the
438 438 * <code>contentPane</code>.
439 439 * Refer to {@link javax.swing.RootPaneContainer} for
440 440 * more information.
441 441 *
442 442 * @param manager the <code>LayoutManager</code>
443 443 * @see #setRootPaneCheckingEnabled
444 444 * @see javax.swing.RootPaneContainer
445 445 */
446 446 public void setLayout(LayoutManager manager) {
447 447 if(isRootPaneCheckingEnabled()) {
448 448 getContentPane().setLayout(manager);
449 449 }
450 450 else {
451 451 super.setLayout(manager);
452 452 }
453 453 }
454 454
455 455
456 456 /**
457 457 * Returns the <code>rootPane</code> object for this window.
458 458 * @return the <code>rootPane</code> property for this window
459 459 *
460 460 * @see #setRootPane
461 461 * @see RootPaneContainer#getRootPane
462 462 */
463 463 public JRootPane getRootPane() {
464 464 return rootPane;
465 465 }
466 466
467 467
468 468 /**
469 469 * Sets the new <code>rootPane</code> object for this window.
470 470 * This method is called by the constructor.
471 471 *
472 472 * @param root the new <code>rootPane</code> property
473 473 * @see #getRootPane
474 474 *
475 475 * @beaninfo
476 476 * hidden: true
477 477 * description: the RootPane object for this window.
478 478 */
479 479 protected void setRootPane(JRootPane root) {
480 480 if(rootPane != null) {
481 481 remove(rootPane);
482 482 }
483 483 rootPane = root;
484 484 if(rootPane != null) {
485 485 boolean checkingEnabled = isRootPaneCheckingEnabled();
486 486 try {
487 487 setRootPaneCheckingEnabled(false);
488 488 add(rootPane, BorderLayout.CENTER);
489 489 }
490 490 finally {
491 491 setRootPaneCheckingEnabled(checkingEnabled);
492 492 }
493 493 }
494 494 }
495 495
496 496
497 497 /**
498 498 * Returns the <code>Container</code> which is the <code>contentPane</code>
499 499 * for this window.
500 500 *
501 501 * @return the <code>contentPane</code> property
502 502 * @see #setContentPane
503 503 * @see RootPaneContainer#getContentPane
504 504 */
505 505 public Container getContentPane() {
506 506 return getRootPane().getContentPane();
507 507 }
508 508
509 509 /**
510 510 * Sets the <code>contentPane</code> property for this window.
511 511 * This method is called by the constructor.
512 512 *
513 513 * @param contentPane the new <code>contentPane</code>
514 514 *
515 515 * @exception IllegalComponentStateException (a runtime
516 516 * exception) if the content pane parameter is <code>null</code>
517 517 * @see #getContentPane
518 518 * @see RootPaneContainer#setContentPane
519 519 *
520 520 * @beaninfo
521 521 * hidden: true
522 522 * description: The client area of the window where child
523 523 * components are normally inserted.
524 524 */
525 525 public void setContentPane(Container contentPane) {
526 526 getRootPane().setContentPane(contentPane);
527 527 }
528 528
529 529 /**
530 530 * Returns the <code>layeredPane</code> object for this window.
531 531 *
532 532 * @return the <code>layeredPane</code> property
533 533 * @see #setLayeredPane
534 534 * @see RootPaneContainer#getLayeredPane
535 535 */
536 536 public JLayeredPane getLayeredPane() {
537 537 return getRootPane().getLayeredPane();
538 538 }
539 539
540 540 /**
541 541 * Sets the <code>layeredPane</code> property.
542 542 * This method is called by the constructor.
543 543 *
544 544 * @param layeredPane the new <code>layeredPane</code> object
545 545 *
546 546 * @exception IllegalComponentStateException (a runtime
547 547 * exception) if the content pane parameter is <code>null</code>
548 548 * @see #getLayeredPane
549 549 * @see RootPaneContainer#setLayeredPane
550 550 *
551 551 * @beaninfo
552 552 * hidden: true
553 553 * description: The pane which holds the various window layers.
554 554 */
555 555 public void setLayeredPane(JLayeredPane layeredPane) {
556 556 getRootPane().setLayeredPane(layeredPane);
557 557 }
558 558
559 559 /**
560 560 * Returns the <code>glassPane Component</code> for this window.
561 561 *
562 562 * @return the <code>glassPane</code> property
563 563 * @see #setGlassPane
564 564 * @see RootPaneContainer#getGlassPane
565 565 */
566 566 public Component getGlassPane() {
567 567 return getRootPane().getGlassPane();
568 568 }
569 569
570 570 /**
571 571 * Sets the <code>glassPane</code> property.
572 572 * This method is called by the constructor.
573 573 * @param glassPane the <code>glassPane</code> object for this window
574 574 *
575 575 * @see #getGlassPane
576 576 * @see RootPaneContainer#setGlassPane
577 577 *
578 578 * @beaninfo
579 579 * hidden: true
580 580 * description: A transparent pane used for menu rendering.
581 581 */
582 582 public void setGlassPane(Component glassPane) {
583 583 getRootPane().setGlassPane(glassPane);
584 584 }
585 585
586 586 /**
587 587 * {@inheritDoc}
588 588 *
589 589 * @since 1.6
590 590 */
591 591 public Graphics getGraphics() {
592 592 JComponent.getGraphicsInvoked(this);
593 593 return super.getGraphics();
594 594 }
595 595
596 596 /**
597 597 * Repaints the specified rectangle of this component within
598 598 * <code>time</code> milliseconds. Refer to <code>RepaintManager</code>
599 599 * for details on how the repaint is handled.
600 600 *
601 601 * @param time maximum time in milliseconds before update
602 602 * @param x the <i>x</i> coordinate
603 603 * @param y the <i>y</i> coordinate
604 604 * @param width the width
605 605 * @param height the height
606 606 * @see RepaintManager
607 607 * @since 1.6
608 608 */
609 609 public void repaint(long time, int x, int y, int width, int height) {
610 610 if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
611 611 RepaintManager.currentManager(this).addDirtyRegion(
612 612 this, x, y, width, height);
613 613 }
614 614 else {
615 615 super.repaint(time, x, y, width, height);
616 616 }
617 617 }
618 618
619 619 /**
620 620 * Returns a string representation of this <code>JWindow</code>.
621 621 * This method
622 622 * is intended to be used only for debugging purposes, and the
623 623 * content and format of the returned string may vary between
624 624 * implementations. The returned string may be empty but may not
625 625 * be <code>null</code>.
626 626 *
627 627 * @return a string representation of this <code>JWindow</code>
628 628 */
629 629 protected String paramString() {
630 630 String rootPaneCheckingEnabledString = (rootPaneCheckingEnabled ?
631 631 "true" : "false");
632 632
633 633 return super.paramString() +
634 634 ",rootPaneCheckingEnabled=" + rootPaneCheckingEnabledString;
635 635 }
636 636
637 637
638 638 /////////////////
639 639 // Accessibility support
640 640 ////////////////
641 641
642 642 /** The accessible context property. */
643 643 protected AccessibleContext accessibleContext = null;
644 644
645 645 /**
646 646 * Gets the AccessibleContext associated with this JWindow.
647 647 * For JWindows, the AccessibleContext takes the form of an
648 648 * AccessibleJWindow.
649 649 * A new AccessibleJWindow instance is created if necessary.
650 650 *
651 651 * @return an AccessibleJWindow that serves as the
652 652 * AccessibleContext of this JWindow
653 653 */
654 654 public AccessibleContext getAccessibleContext() {
655 655 if (accessibleContext == null) {
656 656 accessibleContext = new AccessibleJWindow();
657 657 }
658 658 return accessibleContext;
659 659 }
660 660
661 661
662 662 /**
663 663 * This class implements accessibility support for the
664 664 * <code>JWindow</code> class. It provides an implementation of the
665 665 * Java Accessibility API appropriate to window user-interface
666 666 * elements.
667 667 */
668 668 @SuppressWarnings("serial")
669 669 protected class AccessibleJWindow extends AccessibleAWTWindow {
670 670 // everything is in the new parent, AccessibleAWTWindow
671 671 }
672 672
673 673 }
↓ open down ↓ |
345 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX