public interface RootPaneContainer
getContentPane()
一般是这样的:
公共容器getcontentpane() {getrootpane() getcontentpane()返回;}实现这个接口作为一个Swing GUI建设者需要像JFrame标记治疗成分,含有一个单一的jrootpane,特别。例如,在一个GUI Builder,坠落在rootpanecontainer组件将被解释为
frame.getContentPane().add(child)
。
作为一种方便、标准类实现此接口(如JFrame
,JDialog
,JWindow
,JApplet
,和JInternalFrame
)有自己的add
,remove
,和setLayout
方法重写,使他们的ContentPane
委托调用相应的方法。例如,你可以添加一个组件到一个框架如下:
框架。添加(子);代替:
框架。getcontentpane()添加(孩子);
对JFrame
,JDialog
,JWindow
的add
和setLayout
方法的行为,JApplet
和JInternalFrame
由rootPaneCheckingEnabled
属性控制。如果这个属性为true(默认),然后调用这些方法转发到contentPane
;如果为假,这些方法直接操作的RootPaneContainer
。这个属性只用于子类,因此是受保护的。
Modifier and Type | Method and Description |
---|---|
Container |
getContentPane()
返回的内容块。
|
Component |
getGlassPane()
返回glasspane。
|
JLayeredPane |
getLayeredPane()
返回layeredpane。
|
JRootPane |
getRootPane()
返回该组件的单jrootpane孩子。
|
void |
setContentPane(Container contentPane)
“内容块”是特定于应用程序的组件的主要容器。
|
void |
setGlassPane(Component glassPane)
的glasspane始终是该rootpane第一个和rootpanes布局管理器确保它总是为rootpane一样大。
|
void |
setLayeredPane(JLayeredPane layeredPane)
一个容器管理的内容块,在某些情况下菜单栏。
|
JRootPane getRootPane()
JRootPane
void setContentPane(Container contentPane)
contentPane不得空。
一般采用getRootPane().setContentPane(contentPane);
contentPane
-容器使用这jrootpane内容
IllegalComponentStateException
-(运行时异常)如果内容窗格参数为空
JRootPane.getContentPane()
,
getContentPane()
Container getContentPane()
setContentPane(java.awt.Container)
void setLayeredPane(JLayeredPane layeredPane)
的layeredpane不得空。
一般实现
getrootpane() setlayeredpane(layeredpane);
IllegalComponentStateException
-(运行时异常)如果分层窗格参数为空
getLayeredPane()
,
JRootPane.getLayeredPane()
JLayeredPane getLayeredPane()
setLayeredPane(javax.swing.JLayeredPane)
void setGlassPane(Component glassPane)
的glasspane不得空。
一般采用getRootPane().setGlassPane(glassPane);
Component getGlassPane()
setGlassPane(java.awt.Component)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.