1. /*
  2. * @(#)RootPaneContainer.java 1.15 03/12/19
  3. *
  4. * Copyright 2004 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.awt.Container;
  10. /**
  11. * This interface is implemented by components that have a single
  12. * JRootPane child: JDialog, JFrame, JWindow, JApplet, JInternalFrame.
  13. * The methods in this interface are just <i>covers</i> for the JRootPane
  14. * properties, e.g. <code>getContentPane()</code> is generally implemented
  15. * like this:<pre>
  16. * public Container getContentPane() {
  17. * return getRootPane().getContentPane();
  18. * }
  19. * </pre>
  20. * This interface serves as a <i>marker</i> for Swing GUI builders
  21. * that need to treat components like JFrame, that contain a
  22. * single JRootPane, specially. For example in a GUI builder,
  23. * dropping a component on a RootPaneContainer would be interpreted
  24. * as <code>frame.getContentPane().add(child)</code>.
  25. * <p>
  26. * For conveniance
  27. * <code>JFrame</code>, <code>JDialog</code>, <code>JWindow</code>,
  28. * <code>JApplet</code> and <code>JInternalFrame</code>, by default,
  29. * forward, by default, all calls to the <code>add</code>,
  30. * <code>remove</code> and <code>setLayout</code> methods, to the
  31. * <code>contentPane</code>. This means you can call:
  32. * <pre>
  33. * rootPaneContainer.add(component);
  34. * </pre>
  35. * instead of:
  36. * <pre>
  37. * rootPaneContainer.getContentPane().add(component);
  38. * </pre>
  39. * <p>
  40. * The behavior of the <code>add</code> and
  41. * <code>setLayout</code> methods for
  42. * <code>JFrame</code>, <code>JDialog</code>, <code>JWindow</code>,
  43. * <code>JApplet</code> and <code>JInternalFrame</code> is controlled by
  44. * the <code>rootPaneCheckingEnabled</code> property. If this property is
  45. * true (the default), then calls to these methods are
  46. * forwarded to the <code>contentPane</code> if false, these
  47. * methods operate directly on the <code>RootPaneContainer</code>. This
  48. * property is only intended for subclasses, and is therefore protected.
  49. *
  50. * @see JRootPane
  51. * @see JFrame
  52. * @see JDialog
  53. * @see JWindow
  54. * @see JApplet
  55. * @see JInternalFrame
  56. *
  57. * @version 1.15 12/19/03
  58. * @author Hans Muller
  59. */
  60. public interface RootPaneContainer
  61. {
  62. /**
  63. * Return this component's single JRootPane child. A conventional
  64. * implementation of this interface will have all of the other
  65. * methods indirect through this one. The rootPane has two
  66. * children: the glassPane and the layeredPane.
  67. *
  68. * @return this components single JRootPane child.
  69. * @see JRootPane
  70. */
  71. JRootPane getRootPane();
  72. /**
  73. * The "contentPane" is the primary container for application
  74. * specific components. Applications should add children to
  75. * the contentPane, set its layout manager, and so on.
  76. * <p>
  77. * The contentPane my not be null.
  78. * <p>
  79. * Generally implemented with
  80. * <code>getRootPane().setContentPane(contentPane);</code>
  81. *
  82. * @exception java.awt.IllegalComponentStateException (a runtime
  83. * exception) if the content pane parameter is null
  84. * @param contentPane the Container to use for the contents of this
  85. * JRootPane
  86. * @see JRootPane#getContentPane
  87. * @see #getContentPane
  88. */
  89. void setContentPane(Container contentPane);
  90. /**
  91. * Returns the contentPane.
  92. *
  93. * @return the value of the contentPane property.
  94. * @see #setContentPane
  95. */
  96. Container getContentPane();
  97. /**
  98. * A Container that manages the contentPane and in some cases a menu bar.
  99. * The layeredPane can be used by descendants that want to add a child
  100. * to the RootPaneContainer that isn't layout managed. For example
  101. * an internal dialog or a drag and drop effect component.
  102. * <p>
  103. * The layeredPane may not be null.
  104. * <p>
  105. * Generally implemented with<pre>
  106. * getRootPane().setLayeredPane(layeredPane);</pre>
  107. *
  108. * @exception java.awt.IllegalComponentStateException (a runtime
  109. * exception) if the layered pane parameter is null
  110. * @see #getLayeredPane
  111. * @see JRootPane#getLayeredPane
  112. */
  113. void setLayeredPane(JLayeredPane layeredPane);
  114. /**
  115. * Returns the layeredPane.
  116. *
  117. * @return the value of the layeredPane property.
  118. * @see #setLayeredPane
  119. */
  120. JLayeredPane getLayeredPane();
  121. /**
  122. * The glassPane is always the first child of the rootPane
  123. * and the rootPanes layout manager ensures that it's always
  124. * as big as the rootPane. By default it's transparent and
  125. * not visible. It can be used to temporarily grab all keyboard
  126. * and mouse input by adding listeners and then making it visible.
  127. * by default it's not visible.
  128. * <p>
  129. * The glassPane may not be null.
  130. * <p>
  131. * Generally implemented with
  132. * <code>getRootPane().setGlassPane(glassPane);</code>
  133. *
  134. * @see #getGlassPane
  135. * @see JRootPane#setGlassPane
  136. */
  137. void setGlassPane(Component glassPane);
  138. /**
  139. * Returns the glassPane.
  140. *
  141. * @return the value of the glassPane property.
  142. * @see #setGlassPane
  143. */
  144. Component getGlassPane();
  145. }