1

你好,

我如何使用 JSplitPane 以便它们显示在 BorderLayout 的边框中???

这样我就可以调整每个尺寸(NORTH,EAST,WEST,SOUTH,CENTER)。

谢谢

4

1 回答 1

2

好吧,你真的不需要BorderLayout。您可以将拆分窗格添加在一起以获得该效果。因为JSplitPane仅支持拆分 2 个组件,所以您需要 2 个JSplitPane垂直,而 2JSplitPane在第二个垂直内JSplitPane

JSplitPane horizontal1 = new JSplitPane(
    JSplitPane.HORIZONTAL_SPLIT, yourCenterPanel, yourEastPanel);
JSplitPane horizontal2 = new JSplitPane(
    JSplitPane.HORIZONTAL_SPLIT, yourWestPanel, horizontal1);
JSplitPane vertical1 = new JSplitPane(
    JSplitPane.VERTICAL_SPLIT, horizontal2, yourSouthPanel);
JSplitPane vertical2 = new JSplitPane(
    JSplitPane.VERTICAL_SPLIT, yourNorthPanel, vertical1);
whateverPlaceYouWant.add(vertical2);
于 2010-01-01T17:09:18.727 回答