Border layout has been really popular as it stretches it's contents to fit the parent component. And so I have some JComponent that is laid out with BorderLayout.CENTER
, and I need to show another JComponent a top of it. As some sort of properties window or something. Is there any common way to do it or should I rebuild the whole app?
1123 次
2 に答える
4
BorderLayout.CENTERでレイアウトされたJComponentがあり、その上に別のJComponentを表示する必要があります
2つ(3つの方法)があります
使用する
GlassPane
使用
JLayer (Java7)
、に基づいてJXLayer (Java6)
JViewport
ある場合は(ではComponent
なく)使用Container
してください(必要な数値Swing GUI
はJFrame
--- )JScrollPane
JPanel
エリア
CardLayout
での使用JFrames CENTER
(暗闇に向かって撃たれた)ビューを切り替えるための現在のコードブロックの最後のコード行として
(re)validate
最もrepaint()
近い呼び出しContainer
JPanels
編集
OverlayLayoutも使用できます
于 2012-09-19T12:05:17.547 に答える
3
You could use the Layered Panes Component.
于 2012-09-19T12:03:48.923 に答える