1. /*
  2. * @(#)JLayeredPane.java 1.34 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing;
  8. import java.awt.Component;
  9. import java.util.Hashtable;
  10. import java.awt.Color;
  11. import java.awt.Graphics;
  12. import java.awt.Rectangle;
  13. import javax.accessibility.*;
  14. /**
  15. * JLayeredPane adds depth to a JFC/Swing container, allowing components to overlap
  16. * each other when needed. An Integer object specifies each component's depth in the
  17. * container, where higher-numbered components sit "on top" of other
  18. * components.
  19. * <P>
  20. * <TABLE ALIGN="RIGHT" BORDER="0">
  21. * <TR>
  22. * <TD ALIGN="CENTER">
  23. * <P ALIGN="CENTER"><IMG SRC="doc-files/JLayeredPane-1.gif" WIDTH="269" HEIGHT="264" ALIGN="BOTTOM" BORDER="0">
  24. * </TD>
  25. * </TR>
  26. * </TABLE>
  27. * For convenience, JLayeredPane divides the depth-range into several different
  28. * layers. Putting a component into one of those layers makes it easy to ensure
  29. * that components overlap properly, without having to worry about specifying
  30. * numbers for specific depths:
  31. * <DL>
  32. * <DT><FONT SIZE="2">DEFAULT_LAYER</FONT></DT>
  33. * <DD>The standard layer, where most components go. This the bottommost
  34. * layer.
  35. * <DT><FONT SIZE="2">PALETTE_LAYER</FONT></DT>
  36. * <DD>The palette layer sits over the default layer. Useful for floating
  37. * toolbars and palettes, so they can be positioned above other components.
  38. * <DT><FONT SIZE="2">MODAL_LAYER</FONT></DT>
  39. * <DD>The layer used for modal dialogs. They will appear on top of any
  40. * toolbars, palettes, or standard components in the container.
  41. * <DT><FONT SIZE="2">POPUP_LAYER</FONT></DT>
  42. * <DD>The popup layer displays above dialogs. That way, the popup windows
  43. * associated with combo boxes, tooltips, and other help text will appear
  44. * above the component, palette, or dialog that generated them.
  45. * <DT><FONT SIZE="2">DRAG_LAYER</FONT></DT>
  46. * <DD>When dragging a component, reassigning it to the drag layer ensures
  47. * that it is positioned over every other component in the container. When
  48. * finished dragging, it can be reassigned to its normal layer.
  49. * </DL>
  50. * The JLayeredPane methods <code>moveToFront(Component)</code>,
  51. * <code>moveToBack(Component)</code> and <code>setPosition</code> can be used
  52. * to reposition a component within its layer. The <code>setLayer</code> method
  53. * can also be used to change the component's current layer.
  54. *
  55. * <h2>Details</h2>
  56. * JLayeredPane manages it's list of children like Container, but
  57. * allows for the definition of a several layers within itself. Children
  58. * in the same layer are managed exactly like the normal Container object,
  59. * with the added feature that when children components overlap, children
  60. * in higher layers display above the children in lower layers.
  61. * <p>
  62. * Each layer is a distinct integer number. The layer attribute can be set
  63. * on a Component by passing an Integer object during the add call.<br>
  64. * For example:
  65. * <PRE>
  66. * layeredPane.add(child, JLayeredPane.DEFAULT_LAYER);
  67. * or
  68. * layeredPane.add(child, new Integer(10));
  69. * </PRE>
  70. * The layer attribute can also be set on a Component by calling<PRE>
  71. * layeredPaneParent.setLayer(child, 10)</PRE>
  72. * on the JLayeredPane that is the parent of component. The layer
  73. * should be set <i>before</i> adding the child to the parent.
  74. * <p>
  75. * Higher number layers display above lower number layers. So, using
  76. * numbers for the layers and letters for individual components, a
  77. * representative list order would look like this:<PRE>
  78. * 5a, 5b, 5c, 2a, 2b, 2c, 1a </PRE>
  79. * where the leftmost components are closest to the top of the display.
  80. * <p>
  81. * A component can be moved to the top or bottom position within its
  82. * layer by calling <code>moveToFront</code> or <code>moveToBack</code>.
  83. * <p>
  84. * The position of a component within a layer can also be specified directly.
  85. * Valid positions range from 0 up to one less than the number of
  86. * components in that layer. A value of -1 indicates the bottommost
  87. * position. A value of 0 indicates the topmost position. Unlike layer
  88. * numbers, higher position values are <i>lower</i> in the display.
  89. * <blockquote>
  90. * <b>Note:</b> This sequence (defined by java.awt.Container) is the reverse
  91. * of the layer numbering sequence. Usually though, you will use <code>moveToFront</code>,
  92. * <code>moveToBack</code>, and <code>setLayer</code>.
  93. * </blockquote>
  94. * Here are some examples using the method add(Component, layer, position):
  95. * Calling add(5x, 5, -1) results in:<PRE>
  96. * 5a, 5b, 5c, 5x, 2a, 2b, 2c, 1a </PRE>
  97. *
  98. * Calling add(5z, 5, 2) results in:<PRE>
  99. * 5a, 5b, 5z, 5c, 5x, 2a, 2b, 2c, 1a </PRE>
  100. *
  101. * Calling add(3a, 3, 7) results in:<PRE>
  102. * 5a, 5b, 5z, 5c, 5x, 3a, 2a, 2b, 2c, 1a </PRE>
  103. *
  104. * Using normal paint/event mechanics results in 1a appearing at the bottom
  105. * and 5a being above all other components.
  106. * <p>
  107. * <b>Note:</b> that these layers are simply a logical construct and LayoutManagers
  108. * will affect all child components of this container without regard for
  109. * layer settings.
  110. * <p>
  111. * <strong>Warning:</strong>
  112. * Serialized objects of this class will not be compatible with
  113. * future Swing releases. The current serialization support is appropriate
  114. * for short term storage or RMI between applications running the same
  115. * version of Swing. A future release of Swing will provide support for
  116. * long term persistence.
  117. *
  118. * @version 1.34 11/29/01
  119. * @author David Kloba
  120. */
  121. public class JLayeredPane extends JComponent implements Accessible {
  122. /// Watch the values in getObjectForLayer()
  123. /** Convenience object defining the Default layer. Equivalent to new Integer(0).*/
  124. public final static Integer DEFAULT_LAYER = new Integer(0);
  125. /** Convenience object defining the Palette layer. Equivalent to new Integer(100).*/
  126. public final static Integer PALETTE_LAYER = new Integer(100);
  127. /** Convenience object defining the Modal layer. Equivalent to new Integer(200).*/
  128. public final static Integer MODAL_LAYER = new Integer(200);
  129. /** Convenience object defining the Popup layer. Equivalent to new Integer(300).*/
  130. public final static Integer POPUP_LAYER = new Integer(300);
  131. /** Convenience object defining the Drag layer. Equivalent to new Integer(400).*/
  132. public final static Integer DRAG_LAYER = new Integer(400);
  133. /** Convenience object defining the Frame Content layer.
  134. * This layer is normally only use to positon the contentPane and menuBar
  135. * components of JFrame.
  136. * Equivalent to new Integer(-30000).
  137. * @see JFrame
  138. */
  139. public final static Integer FRAME_CONTENT_LAYER = new Integer(-30000);
  140. /** Bound property */
  141. public final static String LAYER_PROPERTY = "layeredContainerLayer";
  142. // Hashtable to store layer values for non-JComponent components
  143. private Hashtable componentToLayer;
  144. private boolean optimizedDrawingPossible = true;
  145. //////////////////////////////////////////////////////////////////////////////
  146. //// Container Override methods
  147. //////////////////////////////////////////////////////////////////////////////
  148. /** Create a new JLayeredPane */
  149. public JLayeredPane() {
  150. setLayout(null);
  151. }
  152. private void validateOptimizedDrawing() {
  153. boolean layeredComponentFound = false;
  154. synchronized(getTreeLock()) {
  155. int i,d;
  156. Integer layer = null;
  157. for(i=0,d=getComponentCount();i<d;i++) {
  158. layer = null;
  159. if(getComponent(i) instanceof JInternalFrame ||
  160. (getComponent(i) instanceof JComponent &&
  161. (layer = (Integer)((JComponent)getComponent(i)).getClientProperty(LAYER_PROPERTY)) != null)) {
  162. if(layer != null && layer.equals(FRAME_CONTENT_LAYER))
  163. continue;
  164. layeredComponentFound = true;
  165. break;
  166. }
  167. }
  168. }
  169. if(layeredComponentFound)
  170. optimizedDrawingPossible = false;
  171. else
  172. optimizedDrawingPossible = true;
  173. }
  174. protected void addImpl(Component comp, Object constraints, int index) {
  175. int layer = DEFAULT_LAYER.intValue();
  176. int pos;
  177. if(constraints instanceof Integer) {
  178. layer = ((Integer)constraints).intValue();
  179. setLayer(comp, layer);
  180. } else
  181. layer = getLayer(comp);
  182. pos = insertIndexForLayer(layer, index);
  183. super.addImpl(comp, constraints, pos);
  184. comp.validate();
  185. comp.repaint();
  186. validateOptimizedDrawing();
  187. }
  188. /**
  189. * Remove the indexed component from this pane.
  190. * This is the absolute index, ignoring layers.
  191. *
  192. * @param index an int specifying the component to remove
  193. * @see #getIndexOf
  194. */
  195. public void remove(int index) {
  196. Component c = getComponent(index);
  197. super.remove(index);
  198. validateOptimizedDrawing();
  199. }
  200. /**
  201. * Returns false if components in the pane can overlap, which makes
  202. * optimized drawing impossible. Otherwise, returns true.
  203. *
  204. * @return false if components can overlap, else true
  205. * @see JComponent#isOptimizedDrawingEnabled
  206. */
  207. public boolean isOptimizedDrawingEnabled() {
  208. return optimizedDrawingPossible;
  209. }
  210. //////////////////////////////////////////////////////////////////////////////
  211. //// New methods for managing layers
  212. //////////////////////////////////////////////////////////////////////////////
  213. /** Sets the layer property on a JComponent. This method does not cause
  214. * any side effects like setLayer() (painting, add/remove, etc).
  215. * Normally you should use the instance method setLayer(), in order to
  216. * get the desired side-effects (like repainting).
  217. *
  218. * @param c the JComponent to move
  219. * @param layer an int specifying the layer to move it to
  220. * @see #setLayer
  221. */
  222. public static void putLayer(JComponent c, int layer) {
  223. /// MAKE SURE THIS AND setLayer(Component c, int layer, int position) are SYNCED
  224. Integer layerObj;
  225. layerObj = new Integer(layer);
  226. c.putClientProperty(LAYER_PROPERTY, layerObj);
  227. }
  228. /** Gets the layer property for a JComponent, it
  229. * does not cause any side effects like setLayer(). (painting, add/remove, etc)
  230. * Normally you should use the instance method getLayer().
  231. *
  232. * @param c the JComponent to check
  233. * @return an int specifying the component's layer
  234. */
  235. public static int getLayer(JComponent c) {
  236. Integer i;
  237. if((i = (Integer)c.getClientProperty(LAYER_PROPERTY)) != null)
  238. return i.intValue();
  239. return DEFAULT_LAYER.intValue();
  240. }
  241. /** Convenience method that returns the first JLayeredPane which
  242. * contains the specified component. Note that all JFrames have a
  243. * JLayeredPane at their root, so any component in a JFrame will
  244. * have a JLayeredPane parent.
  245. *
  246. * @param c the Component to check
  247. * @return the JLayeredPane that contains the component, or
  248. * null if no JLayeredPane is found in the component
  249. * hierarchy
  250. * @see JFrame
  251. * @see JRootPane
  252. */
  253. public static JLayeredPane getLayeredPaneAbove(Component c) {
  254. if(c == null) return null;
  255. Component parent = c.getParent();
  256. while(parent != null && !(parent instanceof JLayeredPane))
  257. parent = parent.getParent();
  258. return (JLayeredPane)parent;
  259. }
  260. /** Sets the layer attribute on the specified component,
  261. * making it the bottommost component in that layer.
  262. * Should be called before adding to parent.
  263. *
  264. * @param c the Component to set the layer for
  265. * @param layer an int specifying the layer to set, where
  266. * lower numbers are closer to the bottom
  267. */
  268. public void setLayer(Component c, int layer) {
  269. setLayer(c, layer, -1);
  270. }
  271. /** Sets the layer attribute for the specified component and
  272. * also sets its position within that layer.
  273. *
  274. * @param c the Component to set the layer for
  275. * @param layer an int specifying the layer to set, where
  276. * lower numbers are closer to the bottom
  277. * @param position an int specifying the position within the
  278. * layer, where 0 is the topmost position and -1
  279. * is the bottommost position
  280. */
  281. public void setLayer(Component c, int layer, int position) {
  282. Integer layerObj;
  283. layerObj = getObjectForLayer(layer);
  284. if(layer == getLayer(c) && position == getPosition(c)) {
  285. if(c instanceof JComponent)
  286. repaint(((JComponent)c)._bounds);
  287. else
  288. repaint(c.getBounds());
  289. return;
  290. }
  291. /// MAKE SURE THIS AND putLayer(JComponent c, int layer) are SYNCED
  292. if(c instanceof JComponent)
  293. ((JComponent)c).putClientProperty(LAYER_PROPERTY, layerObj);
  294. else
  295. getComponentToLayer().put((Component)c, layerObj);
  296. if(c.getParent() == null || c.getParent() != this) {
  297. if(c instanceof JComponent)
  298. repaint(((JComponent)c)._bounds);
  299. else
  300. repaint(c.getBounds());
  301. return;
  302. }
  303. // Remove the Component and re-add after re-setting the layer
  304. // this is necessary now because I have no access to the
  305. // components[] in Container, to reorder things.
  306. remove(c);
  307. // ALERT passing NULL here for the constraints may be bad
  308. // the current hacks to fix this smell bad right now.
  309. // Cannot override
  310. add(c, null, position);
  311. if(c instanceof JComponent)
  312. repaint(((JComponent)c)._bounds);
  313. else
  314. repaint(c.getBounds());
  315. }
  316. /**
  317. * Returns the layer attribute for the specified Component.
  318. *
  319. * @param c the Component to check
  320. * @return an int specifying the component's current layer
  321. */
  322. public int getLayer(Component c) {
  323. Integer i;
  324. if(c instanceof JComponent)
  325. i = (Integer)((JComponent)c).getClientProperty(LAYER_PROPERTY);
  326. else
  327. i = (Integer)getComponentToLayer().get((Component)c);
  328. if(i == null)
  329. return DEFAULT_LAYER.intValue();
  330. return i.intValue();
  331. }
  332. /**
  333. * Returns the index of the specified Component.
  334. * This is the absolute index, ignoring layers.
  335. * Index numbers, like position numbers, have the topmost component
  336. * at index zero. Larger numbers are closer to the bottom.
  337. *
  338. * @param c the Component to check
  339. * @return an int specifying the component's index
  340. */
  341. public int getIndexOf(Component c) {
  342. int i, count;
  343. count = getComponentCount();
  344. for(i = 0; i < count; i++) {
  345. if(c == getComponent(i))
  346. return i;
  347. }
  348. return -1;
  349. }
  350. /**
  351. * Moves the component to the top of the components in it's current layer
  352. * (position 0).
  353. *
  354. * @param c the Component to move
  355. * @see #setPosition(Component, int)
  356. */
  357. public void moveToFront(Component c) {
  358. setPosition(c, 0);
  359. }
  360. /**
  361. * Moves the component to the bottom of the components in it's current layer
  362. * (position -1).
  363. *
  364. * @param c the Component to move
  365. * @see #setPosition(Component, int)
  366. */
  367. public void moveToBack(Component c) {
  368. setPosition(c, getComponentCountInLayer(getLayer(c)));
  369. }
  370. /**
  371. * Moves the component to <code>position</code> within it's current layer,
  372. * where 0 is the topmost position within the layer and -1 is the bottommost
  373. * position.
  374. * <p>
  375. * <b>Note:</b> Position numbering is defined by java.awt.Container, and
  376. * is the opposite of layer numbering. Lower position numbers are closer
  377. * to the top (0 is topmost), and higher position numbers are closer to
  378. * the bottom.
  379. *
  380. * @param c the Component to move
  381. * @param position an int in the range -1..N-1, where N is the number of
  382. * components in the component's current layer
  383. */
  384. public void setPosition(Component c, int position) {
  385. setLayer(c, getLayer(c), position);
  386. }
  387. /**
  388. * Get the relative position of the component within its layer.
  389. *
  390. * @param c the Component to check
  391. * @return an int giving the component's position, where 0 is the
  392. * topmost position and the highest index value = the count
  393. * count of components at that layer, minus 1
  394. *
  395. * @see #getComponentCountInLayer
  396. */
  397. public int getPosition(Component c) {
  398. int i, count, startLayer, curLayer, startLocation, pos = 0;
  399. count = getComponentCount();
  400. startLocation = getIndexOf(c);
  401. if(startLocation == -1)
  402. return -1;
  403. startLayer = getLayer(c);
  404. for(i = startLocation - 1; i >= 0; i--) {
  405. curLayer = getLayer(getComponent(i));
  406. if(curLayer == startLayer)
  407. pos++;
  408. else
  409. return pos;
  410. }
  411. return pos;
  412. }
  413. /** Returns the highest layer value from all current children.
  414. * Returns 0 if there are no children.
  415. *
  416. * @return an int indicating the layer of the topmost component in the
  417. * pane, or zero if there are no children
  418. */
  419. public int highestLayer() {
  420. if(getComponentCount() > 0)
  421. return getLayer(getComponent(0));
  422. return 0;
  423. }
  424. /** Returns the lowest layer value from all current children.
  425. * Returns 0 if there are no children.
  426. *
  427. * @return an int indicating the layer of the bottommost component in the
  428. * pane, or zero if there are no children
  429. */
  430. public int lowestLayer() {
  431. int count = getComponentCount();
  432. if(count > 0)
  433. return getLayer(getComponent(count-1));
  434. return 0;
  435. }
  436. /**
  437. * Returns the number of children currently in the specified layer.
  438. *
  439. * @param layer an int specifying the layer to check
  440. * @return an int specifying the number of components in that layer
  441. */
  442. public int getComponentCountInLayer(int layer) {
  443. int i, count, curLayer;
  444. int layerCount = 0;
  445. count = getComponentCount();
  446. for(i = 0; i < count; i++) {
  447. curLayer = getLayer(getComponent(i));
  448. if(curLayer == layer) {
  449. layerCount++;
  450. /// Short circut the counting when we have them all
  451. } else if(layerCount > 0 || curLayer < layer) {
  452. break;
  453. }
  454. }
  455. return layerCount;
  456. }
  457. /**
  458. * Returns an array of the components in the specified layer.
  459. *
  460. * @param layer an int specifying the layer to check
  461. * @return an array of Components contained in that layer
  462. */
  463. public Component[] getComponentsInLayer(int layer) {
  464. int i, count, curLayer;
  465. int layerCount = 0;
  466. Component[] results;
  467. results = new Component[getComponentCountInLayer(layer)];
  468. count = getComponentCount();
  469. for(i = 0; i < count; i++) {
  470. curLayer = getLayer(getComponent(i));
  471. if(curLayer == layer) {
  472. results[layerCount++] = getComponent(i);
  473. /// Short circut the counting when we have them all
  474. } else if(layerCount > 0 || curLayer < layer) {
  475. break;
  476. }
  477. }
  478. return results;
  479. }
  480. /**
  481. * Paints this JLayeredPane within the specified graphics context.
  482. *
  483. * @param g the Graphics context within which to paint
  484. */
  485. public void paint(Graphics g) {
  486. if(isOpaque()) {
  487. Rectangle r = g.getClipBounds();
  488. Color c = getBackground();
  489. if(c == null)
  490. c = Color.lightGray;
  491. g.setColor(c);
  492. g.fillRect(r.x, r.y, r.width, r.height);
  493. }
  494. super.paint(g);
  495. }
  496. //////////////////////////////////////////////////////////////////////////////
  497. //// Implementation Details
  498. //////////////////////////////////////////////////////////////////////////////
  499. /**
  500. * Returns the hashtable that maps components to layers.
  501. *
  502. * @return the Hashtable used to map components to their layers
  503. */
  504. protected Hashtable getComponentToLayer() {
  505. if(componentToLayer == null)
  506. componentToLayer = new Hashtable(4);
  507. return componentToLayer;
  508. }
  509. /**
  510. * Returns the Integer object associated with a specified layer.
  511. *
  512. * @param layer an int specifying the layer
  513. * @return an Integer object for that layer
  514. */
  515. protected Integer getObjectForLayer(int layer) {
  516. Integer layerObj;
  517. switch(layer) {
  518. case 0:
  519. layerObj = DEFAULT_LAYER;
  520. break;
  521. case 100:
  522. layerObj = PALETTE_LAYER;
  523. break;
  524. case 200:
  525. layerObj = MODAL_LAYER;
  526. break;
  527. case 300:
  528. layerObj = POPUP_LAYER;
  529. break;
  530. case 400:
  531. layerObj = DRAG_LAYER;
  532. break;
  533. default:
  534. layerObj = new Integer(layer);
  535. }
  536. return layerObj;
  537. }
  538. /**
  539. * Primative method that determines the proper location to
  540. * insert a new child based on layer and position requests.
  541. *
  542. * @param layer an int specifying the layer
  543. * @param position an int specifying the position within the layer
  544. * @return an int giving the (absolute) insertion-index
  545. *
  546. * @see #getIndexOf
  547. */
  548. protected int insertIndexForLayer(int layer, int position) {
  549. int i, count, curLayer;
  550. int layerStart = -1;
  551. int layerEnd = -1;
  552. count = getComponentCount();
  553. for(i = 0; i < count; i++) {
  554. curLayer = getLayer(getComponent(i));
  555. if(layerStart == -1 && curLayer == layer) {
  556. layerStart = i;
  557. }
  558. if(curLayer < layer ) {
  559. if(i == 0) {
  560. // layer is greater than any current layer
  561. // [ ASSERT(layer > highestLayer()) ]
  562. layerStart = 0;
  563. layerEnd = 0;
  564. } else {
  565. layerEnd = i;
  566. }
  567. break;
  568. }
  569. }
  570. // layer requested is lower than any current layer
  571. // [ ASSERT(layer < lowestLayer()) ]
  572. // put it on the bottom of the stack
  573. if(layerStart == -1 && layerEnd == -1)
  574. return count;
  575. // In the case of a single layer entry handle the degenerative cases
  576. if(layerStart != -1 && layerEnd == -1)
  577. layerEnd = count;
  578. if(layerEnd != -1 && layerStart == -1)
  579. layerStart = layerEnd;
  580. // If we are adding to the bottom, return the last element
  581. if(position == -1)
  582. return layerEnd;
  583. // Otherwise make sure the requested position falls in the
  584. // proper range
  585. if(position > -1 && layerStart + position <= layerEnd)
  586. return layerStart + position;
  587. // Otherwise return the end of the layer
  588. return layerEnd;
  589. }
  590. /**
  591. * Returns a string representation of this JLayeredPane. This method
  592. * is intended to be used only for debugging purposes, and the
  593. * content and format of the returned string may vary between
  594. * implementations. The returned string may be empty but may not
  595. * be <code>null</code>.
  596. *
  597. * @return a string representation of this JLayeredPane.
  598. */
  599. protected String paramString() {
  600. String optimizedDrawingPossibleString = (optimizedDrawingPossible ?
  601. "true" : "false");
  602. return super.paramString() +
  603. ",optimizedDrawingPossible=" + optimizedDrawingPossibleString;
  604. }
  605. /////////////////
  606. // Accessibility support
  607. ////////////////
  608. /**
  609. * Get the AccessibleContext associated with this JComponent
  610. *
  611. * @return the AccessibleContext of this JComponent
  612. */
  613. public AccessibleContext getAccessibleContext() {
  614. if (accessibleContext == null) {
  615. accessibleContext = new AccessibleJLayeredPane();
  616. }
  617. return accessibleContext;
  618. }
  619. /**
  620. * The class used to obtain the accessible role for this object.
  621. * <p>
  622. * <strong>Warning:</strong>
  623. * Serialized objects of this class will not be compatible with
  624. * future Swing releases. The current serialization support is appropriate
  625. * for short term storage or RMI between applications running the same
  626. * version of Swing. A future release of Swing will provide support for
  627. * long term persistence.
  628. */
  629. protected class AccessibleJLayeredPane extends AccessibleJComponent {
  630. /**
  631. * Get the role of this object.
  632. *
  633. * @return an instance of AccessibleRole describing the role of the
  634. * object
  635. * @see AccessibleRole
  636. */
  637. public AccessibleRole getAccessibleRole() {
  638. return AccessibleRole.LAYERED_PANE;
  639. }
  640. }
  641. }