1

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?

4

2 に答える 2

4

BorderLayout.CENTERでレイアウトされたJComponentがあり、その上に別のJComponentを表示する必要があります

  1. 2つ(3つの方法)があります

    • 使用するGlassPane

    • 使用JLayer (Java7)、に基づいてJXLayer (Java6)

    • JViewportある場合は(ではComponentなく)使用Containerしてください(必要な数値Swing GUIJFrame--- )JScrollPaneJPanel

  2. エリアCardLayoutでの使用JFrames CENTER

  3. (暗闇に向かって撃たれた)ビューを切り替えるための現在のコードブロックの最後のコード行として(re)validate最もrepaint()近い呼び出しContainerJPanels

編集

OverlayLayoutも使用できます

于 2012-09-19T12:05:17.547 に答える
3

You could use the Layered Panes Component.

于 2012-09-19T12:03:48.923 に答える