- すべての実装されたインタフェース:
ImageObserver,MenuContainer,Serializable,Accessible
JFrame、JDialog、JWindow、JApplet、およびJInternalFrameによって内部的に使用される軽量コンテナ。 ルート・ペインが提供するタスク指向の情報については、『The Java Tutorial』の「How to Use Root Panes」を参照してください。
次のイメージはルート・ペインを使用するクラス間の関係を示します。

JFrame、JDialog、JWindow、およびJApplet)は、それらが拡張するAWTクラスとの関連で示されています。 Swingライブラリ内の重量コンテナはこれら4つのコンポーネントのみです。 また、軽量コンテナのJInternalFrameも示されています。 これら5つのJFC/SwingコンテナはすべてRootPaneContainerインタフェースを実装し、処理をJRootPane (上部に小さな「ハンドル」が付いている)に委譲します。
ノート:JComponentのメソッドgetRootPaneを使用すると、指定されたコンポーネントを格納しているJRootPaneを取得できます。
例:
JRootPaneの構造を示しています。 JRootpaneは、glassPane、オプションのmenuBar、およびcontentPaneから成ります。 JLayeredPaneはmenuBarとcontentPaneを管理します。 glassPaneはすべてのコンポーネントのいちばん上に置かれ、マウスの動作を捕捉します。 glassPaneは(contentPaneと同様に)、任意コンポーネントにすることができるので、描画のためにglassPaneをセット・アップすることもできます。 glassPane上の線とイメージは、境界に制限されることなく、下のフレーム全体を覆うことができます。
menuBarコンポーネントはなくてもかまいませんが、layeredPane、contentPane、およびglassPaneは必ず必要です。 これらをnullに設定しようとすると、例外が生成されます。
JRootPaneにコンポーネントを追加するには(オプションのメニュー・バーと異なり)、次のようにJRootPaneのcontentPaneにオブジェクトを追加します。
rootPane.getContentPane().add(child);
同様の原則が、レイアウト・マネージャの設定、コンポーネントの削除、および子のリスト表示などでも適用されます。これらのメソッドはすべてJRootPaneではなく、contentPaneで呼び出されます。
ノート:contentPaneのデフォルトのレイアウト・マネージャはBorderLayoutマネージャです。 ただし、JRootPaneはカスタムLayoutManagerを使用します。 したがって、JRootPaneに追加したコンポーネントのレイアウト・マネージャを変更するときは、必ず次のようなコードを使用してください。rootPane.getContentPane().setLayout(new BoxLayout());
JMenuBarコンポーネントがJRootPaneで設定された場合は、フレームの上端に沿って配置されます。 contentPaneの位置とサイズは、残りの領域に収まるように調整されます。 JMenuBarとcontentPaneは、JLayeredPane.FRAME_CONTENT_LAYERレイヤーのlayeredPaneコンポーネントに追加されます。
layeredPaneはJRootPaneのすべての子の親(メニューの直接の親、およびcontentPaneに追加されたすべてのコンポーネントの親の両方)です。 layeredPaneは、複数のレイヤーでコンポーネントを追加する機能を提供するJLayeredPaneのインスタンスです。 この機能は、メニュー・ポップアップやダイアログ・ボックスでの作業およびドラッグなど、コンポーネントをペイン内のほかのすべてのコンポーネントのいちばん上に配置する必要がある場合にとても便利です。
glassPaneはJRootPaneのほかのすべてのコンポーネントのいちばん上に置かれます。 これにより、ほかのすべてのコンポーネントの上に描画するのに都合のよい場所が提供され、ドラッグや描画のときに便利なマウス・イベントの捕捉が可能になります。 glassPaneでsetVisibleを使用すると、いつglassPaneがほかの子の上に表示されるかを制御できます。 デフォルトでは、glassPaneは可視ではありません。
JRootPaneによって使用されるカスタムLayoutManagerは次のことを保証します。
glassPaneはJRootPane(境界 - イン・セット)の表示可能領域全体を埋める。layeredPaneはJRootPane(境界 - イン・セット)の表示可能領域全体を埋める。menuBarはlayeredPaneの上端に配置される。contentPaneは、menuBarを除いた(存在する場合)表示可能領域全体を埋める。
JRootPaneのビュー階層のほかのビューはすべて無視されます。
JRootPaneのLayoutManagerを置換する場合は、これらのビューすべてを管理する必要があります。 したがって、通常はJRootPaneではなくcontentPaneのレイアウト・マネージャを変更するようにしてください。
Swingのペイント・アーキテクチャでは、不透明なJComponentが包含関係の階層の中でほかのすべてのコンポーネントの上に存在する必要があります。 通常、これはコンテンツ・ペインによって提供されます。 コンテンツ・ペインを置き換える場合は、setOpaque(true)によってコンテンツ・ペインを不透明にすることをお薦めします。 また、コンテンツ・ペインによってpaintComponentがオーバーライドされる場合は、バックグラウンドをpaintComponentの不透明な色で完全に塗りつぶす必要があります。
警告: Swingはスレッドに対して安全ではありません。 詳細は、「Swing's Threading Policy」を参照してください。
警告: このクラスの直列化されたオブジェクトは、今後のSwingリリースと互換ではなくなる予定です。 現在の直列化のサポートは、短期間の格納や、同じバージョンのSwingを実行するアプリケーション間のRMIに適しています。 1.4では、すべてのJavaBeansの長期ストレージのサポートがjava.beansパッケージに追加されました。 XMLEncoderを参照してください。
- 導入されたバージョン:
- 1.2
- 関連項目:
-
ネストされたクラスのサマリー
ネストされたクラス修飾子と型クラス説明protected classこのクラスはJRootPaneクラスのアクセシビリティ・サポートを実装しています。protected classlayeredPane、glassPane、およびmenuBarのレイアウトを処理するカスタム・レイアウト・マネージャです。クラスjavax.swing.JComponentで宣言されたネストされたクラス/インタフェース
JComponent.AccessibleJComponentクラスjava.awt.Containerで宣言されたネストされたクラス/インタフェース
Container.AccessibleAWTContainerクラスjava.awt.Componentで宣言されたネストされたクラス/インタフェース
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
フィールドのサマリー
フィールド修飾子と型フィールド説明static final intwindowDecorationStyleプロパティに使用する定数です。protected Containerコンテンツ・ペインです。protected JButtonペインがフォーカスを持つとき、およびEnterキーを押すなどのUI固有のアクションを持つときにアクティブになるボタンです。static final intwindowDecorationStyleプロパティに使用する定数です。static final intwindowDecorationStyleプロパティに使用する定数です。static final intwindowDecorationStyleプロパティに使用する定数です。protected Componentメニュー・バーとコンテンツ・ペインにオーバーレイするガラス・ペインです。マウスの動作などを捕捉できます。static final intwindowDecorationStyleプロパティに使用する定数です。protected JLayeredPaneメニュー・バーとコンテンツ・ペインを管理する階層化ペインです。protected JMenuBarメニュー・バーです。static final intwindowDecorationStyleプロパティに使用する定数です。static final intwindowDecorationStyleプロパティに使用する定数です。static final intwindowDecorationStyleプロパティに使用する定数です。static final intwindowDecorationStyleプロパティに使用する定数です。クラスjavax.swing.JComponentで宣言されたフィールド
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWクラスjava.awt.Componentで宣言されたフィールド
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTインタフェースjava.awt.image.ImageObserverで宣言されているフィールド
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
コンストラクタのサマリー
コンストラクタ -
メソッドのサマリー
修飾子と型メソッド説明protected voidガラス・コンポーネントの位置を子0として適用するためにオーバーライドされます。protected ContainerデフォルトのcontentPaneを作成するために、コンストラクタ・メソッドから呼び出されます。protected ComponentデフォルトのglassPaneを作成するために、コンストラクタ・メソッドから呼び出されます。protected JLayeredPaneデフォルトのlayeredPaneを作成するために、コンストラクタ・メソッドから呼び出されます。protected LayoutManagerデフォルトのlayoutManagerを作成するために、コンストラクタ・メソッドから呼び出されます。このJRootPaneに関連付けられているAccessibleContextを取得します。ルート・ペインが親になるコンポーネントを保持するコンテナである、コンテンツ・ペインを返します。defaultButtonプロパティの値を返します。このJRootPaneの現在のガラス・ペインを返します。階層化ペインからメニュー・バーを返します。ルート・ペインが使用する階層化ペインを取得します。非推奨。getUI()このコンポーネントをレンダリングするL&Fオブジェクトを返します。このコンポーネントをレンダリングするL&Fクラスの名前を指定する文字列を返します。intJRootPaneが提供するウィンドウ装飾のタイプを識別する定数を返します。booleanglassPaneとcontentPaneは同じ境界を持つため、JRootPaneはその子をタイリングせず、falseを返します。booleanこのJRootPaneの下位オブジェクトがrevalidateを呼び出した場合、ここから下へ向かって検証します。protected StringこのJRootPaneの文字列表現を返します。voidsetContentPane(Container content) ルート・ペインが親になるコンポーネントを保持するコンテナである、コンテンツ・ペインを設定します。voidsetDefaultButton(JButton defaultButton) defaultButtonプロパティを設定して、このJRootPaneの現在のデフォルト・ボタンを指定します。voidsetDoubleBuffered(boolean aFlag) このコンポーネントがバッファを使用してペイントするかどうかを設定します。voidsetGlassPane(Component glass) 指定したComponentがこのルート・ペインのガラス・ペインになるように設定します。voidsetJMenuBar(JMenuBar menu) 階層化ペインで使用されるメニュー・バーを追加または変更します。voidsetLayeredPane(JLayeredPane layered) ルート・ペインに階層化ペインを設定します。voidsetMenuBar(JMenuBar menu) 非推奨。Swing version 1.0.3以降は、setJMenuBar(JMenuBar menu)に置き換えられています。voidsetUI(RootPaneUI ui) このコンポーネントをレンダリングするL&Fオブジェクトを設定します。voidsetWindowDecorationStyle(int windowDecorationStyle) JRootPaneが提供するウィンドウ装飾の種類(ボーダー、Windowを閉じるためのウィジェット、タイトルなど)を設定します。voidupdateUI()現在のルック・アンド・フィールからの値にUIプロパティをリセットします。クラスjavax.swing.JComponentで宣言されたメソッド
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateクラスjava.awt.Containerで宣言されたメソッド
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeクラスjava.awt.Componentで宣言されたメソッド
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
フィールド詳細
-
NONE
public static final int NONEwindowDecorationStyleプロパティに使用する定数です。JRootPaneがどんなWindow装飾も提供しないように指示します。- 導入されたバージョン:
- 1.4
- 関連項目:
-
FRAME
public static final int FRAMEwindowDecorationStyleプロパティに使用する定数です。JRootPaneがFrameに適した装飾を提供するように指示します。- 導入されたバージョン:
- 1.4
- 関連項目:
-
PLAIN_DIALOG
public static final int PLAIN_DIALOGwindowDecorationStyleプロパティに使用する定数です。JRootPaneがDialogに適した装飾を提供するように指示します。- 導入されたバージョン:
- 1.4
- 関連項目:
-
INFORMATION_DIALOG
public static final int INFORMATION_DIALOGwindowDecorationStyleプロパティに使用する定数です。JRootPaneが、情報メッセージを表示するためのDialogに適した装飾を提供するように指示します。- 導入されたバージョン:
- 1.4
- 関連項目:
-
ERROR_DIALOG
public static final int ERROR_DIALOGwindowDecorationStyleプロパティに使用する定数です。JRootPaneが、エラー・メッセージを表示するためのDialogに適した装飾を提供するように指示します。- 導入されたバージョン:
- 1.4
- 関連項目:
-
COLOR_CHOOSER_DIALOG
public static final int COLOR_CHOOSER_DIALOGwindowDecorationStyleプロパティに使用する定数です。JRootPaneが、JColorChooserを表示するためのDialogに適した装飾を提供するように指示します。- 導入されたバージョン:
- 1.4
- 関連項目:
-
FILE_CHOOSER_DIALOG
public static final int FILE_CHOOSER_DIALOGwindowDecorationStyleプロパティに使用する定数です。JRootPaneが、JFileChooserを表示するためのDialogに適した装飾を提供するように指示します。- 導入されたバージョン:
- 1.4
- 関連項目:
-
QUESTION_DIALOG
public static final int QUESTION_DIALOGwindowDecorationStyleプロパティに使用する定数です。JRootPaneが、ユーザーにクエスチョンを表示するためのDialogに適した装飾を提供するように指示します。- 導入されたバージョン:
- 1.4
- 関連項目:
-
WARNING_DIALOG
public static final int WARNING_DIALOGwindowDecorationStyleプロパティに使用する定数です。JRootPaneが、警告メッセージを表示するためのDialogに適切な装飾を提供するように指示します。- 導入されたバージョン:
- 1.4
- 関連項目:
-
contentPane
protected Container contentPaneコンテンツ・ペインです。 -
layeredPane
protected JLayeredPane layeredPaneメニュー・バーとコンテンツ・ペインを管理する階層化ペインです。 -
glassPane
protected Component glassPaneメニュー・バーとコンテンツ・ペインにオーバーレイするガラス・ペインです。マウスの動作などを捕捉できます。 -
defaultButton
protected JButton defaultButtonペインがフォーカスを持つとき、およびEnterキーを押すなどのUI固有のアクションを持つときにアクティブになるボタンです。
-
-
コンストラクタの詳細
-
JRootPane
public JRootPane()JRootPaneを作成し、glassPane、layeredPane、およびcontentPaneを設定します。
-
-
メソッドの詳細
-
setDoubleBuffered
public void setDoubleBuffered(boolean aFlag) このコンポーネントがバッファを使用してペイントするかどうかを設定します。 trueに設定されている場合、このコンポーネントからのすべての描画はオフスクリーン描画バッファで行われます。 それからオフスクリーン描画バッファが画面にコピーされます。Componentがバッファリングされており、その上位オブジェクトもバッファリングされている場合、上位オブジェクトのバッファが使用されます。- オーバーライド:
setDoubleBuffered、クラスJComponent- パラメータ:
aFlag- trueの場合、このコンポーネントでダブル・バッファを使用するように設定- 導入されたバージョン:
- 1.6
-
getWindowDecorationStyle
public int getWindowDecorationStyle()JRootPaneが提供するウィンドウ装飾のタイプを識別する定数を返します。- 戻り値:
NONE、FRAME、PLAIN_DIALOG、INFORMATION_DIALOG、ERROR_DIALOG、COLOR_CHOOSER_DIALOG、FILE_CHOOSER_DIALOG、QUESTION_DIALOG、またはWARNING_DIALOGのいずれか。- 導入されたバージョン:
- 1.4
- 関連項目:
-
setWindowDecorationStyle
@BeanProperty(expert=true, visualUpdate=true, enumerationValues={"JRootPane.NONE","JRootPane.FRAME","JRootPane.PLAIN_DIALOG","JRootPane.INFORMATION_DIALOG","JRootPane.ERROR_DIALOG","JRootPane.COLOR_CHOOSER_DIALOG","JRootPane.FILE_CHOOSER_DIALOG","JRootPane.QUESTION_DIALOG","JRootPane.WARNING_DIALOG"}, description="Identifies the type of Window decorations to provide") public void setWindowDecorationStyle(int windowDecorationStyle) JRootPaneが提供するウィンドウ装飾の種類(ボーダー、Windowを閉じるためのウィジェット、タイトルなど)を設定します。 デフォルトの設定はWindow装飾なし(NONE)です。これはヒントに過ぎず、一部のルック・アンド・フィールはこれをサポートしていません。 これはバウンド・プロパティです。
- パラメータ:
windowDecorationStyle- 提供するウィンドウの装飾を識別する定数。- 例外:
IllegalArgumentException-styleがNONE、FRAME、PLAIN_DIALOG、INFORMATION_DIALOG、ERROR_DIALOG、COLOR_CHOOSER_DIALOG、FILE_CHOOSER_DIALOG、QUESTION_DIALOG、またはWARNING_DIALOGのいずれでもない場合。- 導入されたバージョン:
- 1.4
- 関連項目:
-
getUI
public RootPaneUI getUI()このコンポーネントをレンダリングするL&Fオブジェクトを返します。- オーバーライド:
- クラス
JComponentのgetUI - 戻り値:
LabelUIオブジェクト- 導入されたバージョン:
- 1.3
-
setUI
@BeanProperty(expert=true, hidden=true, visualUpdate=true, description="The UI object that implements the Component\'s LookAndFeel.") public void setUI(RootPaneUI ui) このコンポーネントをレンダリングするL&Fオブジェクトを設定します。- パラメータ:
ui-LabelUIL&Fオブジェクト- 導入されたバージョン:
- 1.3
- 関連項目:
-
updateUI
-
getUIClassID
public String getUIClassID()このコンポーネントをレンダリングするL&Fクラスの名前を指定する文字列を返します。- オーバーライド:
getUIClassID、クラスJComponent- 戻り値:
- 文字列「RootPaneUI」
- 関連項目:
-
createLayeredPane
protected JLayeredPane createLayeredPane()デフォルトのlayeredPaneを作成するために、コンストラクタ・メソッドから呼び出されます。 デフォルトでは、新しいJLayeredPaneを作成します。- 戻り値:
- デフォルトの
layeredPane
-
createContentPane
protected Container createContentPane()デフォルトのcontentPaneを作成するために、コンストラクタ・メソッドから呼び出されます。 デフォルトでは、このメソッドは新しいJComponentを作成し、LayoutManagerとしてBorderLayoutを設定します。- 戻り値:
- デフォルトの
contentPane
-
createGlassPane
protected Component createGlassPane()デフォルトのglassPaneを作成するために、コンストラクタ・メソッドから呼び出されます。 デフォルトでは、このメソッドは可視性をfalseに設定して新しいJComponentを作成します。- 戻り値:
- デフォルトの
glassPane
-
createRootLayout
protected LayoutManager createRootLayout()デフォルトのlayoutManagerを作成するために、コンストラクタ・メソッドから呼び出されます。- 戻り値:
- デフォルトの
layoutManager。
-
setJMenuBar
-
setMenuBar
@Deprecated public void setMenuBar(JMenuBar menu) 非推奨。Swing version 1.0.3以降は、setJMenuBar(JMenuBar menu)に置き換えられています。メニュー・バーの値を指定します。- パラメータ:
menu- 追加するJMenuBar。
-
getJMenuBar
-
getMenuBar
@Deprecated public JMenuBar getMenuBar()非推奨。Swing version 1.0.3以降は、getJMenuBar()に置き換えられています。メニュー・バーの値を返します。- 戻り値:
- ペインで使用される
JMenuBar
-
setContentPane
public void setContentPane(Container content) ルート・ペインが親になるコンポーネントを保持するコンテナである、コンテンツ・ペインを設定します。Swingのペイント・アーキテクチャでは、包含関係の階層に不透明な
JComponentが含まれている必要があります。 通常、これはコンテンツ・ペインによって提供されます。 コンテンツ・ペインを置き換える場合は、不透明なJComponentと置き換えることをお勧めします。- パラメータ:
content- コンポーネント・コンテンツに使用するContainer- 例外:
IllegalComponentStateException- (実行時例外)コンテンツ・ペイン・パラメータがnullの場合
-
getContentPane
public Container getContentPane()ルート・ペインが親になるコンポーネントを保持するコンテナである、コンテンツ・ペインを返します。- 戻り値:
- コンポーネント・コンテンツを保持する
Container
-
setLayeredPane
public void setLayeredPane(JLayeredPane layered) ルート・ペインに階層化ペインを設定します。 通常、階層化ペインはコンテンツ・ペインとオプションのJMenuBarを保持します。- パラメータ:
layered- 使用するJLayeredPane- 例外:
IllegalComponentStateException- (実行時例外)階層化ペインのパラメータがnullの場合
-
getLayeredPane
public JLayeredPane getLayeredPane()ルート・ペインが使用する階層化ペインを取得します。 通常、階層化ペインはコンテンツ・ペインとオプションのJMenuBarを保持します。- 戻り値:
- 現在使用されている
JLayeredPane
-
setGlassPane
public void setGlassPane(Component glass) 指定したComponentがこのルート・ペインのガラス・ペインになるように設定します。 ルート・ペインが入力イベントを捕捉する必要があるときには必ず可視にされるので、通常、ガラス・ペインは軽量の透明なコンポーネントである必要があります。新しいガラス・ペインの可視設定は、現在のガラス・ペインの可視設定に一致するように変更されます。 このため、ガラス・ペインを置き換えて可視にするときは、注意が必要です。 次のいずれかの方法を使用します。
root.setGlassPane(newGlassPane); newGlassPane.setVisible(true);
またはroot.getGlassPane().setVisible(true); root.setGlassPane(newGlassPane);
- パラメータ:
glass- このJRootPaneのガラス・ペインとして使用するComponent- 例外:
NullPointerException-glassパラメータがnullの場合
-
getGlassPane
-
isValidateRoot
public boolean isValidateRoot()このJRootPaneの下位オブジェクトがrevalidateを呼び出した場合、ここから下へ向かって検証します。コンポーネントおよびその子孫の再配置の延期された要求です。 たとえば、
revalidateの呼出しはJRootPaneまたはJScrollPaneのどちらかに転送されます。これは、どちらのクラスもisValidateRootをオーバーライドしてtrueを返すためです。- オーバーライド:
isValidateRoot、クラスJComponent- 戻り値:
- true
- 関連項目:
-
isOptimizedDrawingEnabled
public boolean isOptimizedDrawingEnabled()glassPaneとcontentPaneは同じ境界を持つため、JRootPaneはその子をタイリングせず、falseを返します。 一方、通常glassPaneは不可視なので、glassPaneが可視でない場合、trueを返します。 つまり、このメソッドの戻り値はglassPaneの可視性によって異なります。- オーバーライド:
isOptimizedDrawingEnabled、クラスJComponent- 戻り値:
- このコンポーネントの子がオーバーラップしない場合はtrue
-
setDefaultButton
@BeanProperty(description="The button activated by default in this root pane") public void setDefaultButton(JButton defaultButton) defaultButtonプロパティを設定して、このJRootPaneの現在のデフォルト・ボタンを指定します。 デフォルト・ボタンは、ボタンにキーボード・フォーカスがあるかどうかにかかわらず、ルート・ペインでUI定義の起動イベント(通常はEnterキー)が発生したときに起動されるボタンです(ルート・ペイン内にJTextPaneなどの起動イベントを消費する別のコンポーネントがある場合を除く)。 デフォルトの起動が機能するには、ボタンは起動が発生した時点でルート・ペインの使用可能な子孫である必要があります。 このルート・ペインからデフォルト・ボタンを削除するには、このプロパティをnullに設定します。- パラメータ:
defaultButton- デフォルト・ボタンになるJButton- 関連項目:
-
getDefaultButton
-
addImpl
-
paramString
protected String paramString()このJRootPaneの文字列表現を返します。 このメソッドはデバッグ専用であり、返される文字列の内容および形式は実装によって異なる可能性があります。 返される文字列は空でもかまいませんが、nullにはできません。- オーバーライド:
paramString、クラスJComponent- 戻り値:
- この
JRootPaneを表す文字列表現。
-
getAccessibleContext
public AccessibleContext getAccessibleContext()このJRootPaneに関連付けられているAccessibleContextを取得します。 ルート・ペインの場合、AccessibleContextはAccessibleJRootPaneの形式を取ります。 必要に応じて、新しいAccessibleJRootPaneインスタンスが作成されます。- 定義:
getAccessibleContext、インタフェースAccessible- オーバーライド:
getAccessibleContext、クラスComponent- 戻り値:
- この
JRootPaneのAccessibleContextとして機能するAccessibleJRootPane
-
getJMenuBar()に置き換えられています。