【发布时间】:2010-12-31 15:15:17
【问题描述】:
嗨,
如何使用 JSplitPane 以便它们显示在 BorderLayout 的边框中???
这样我就可以调整每个尺寸(北、东、西、南、中)的大小。
谢谢
【问题讨论】:
标签: java swing layout border jsplitpane
嗨,
如何使用 JSplitPane 以便它们显示在 BorderLayout 的边框中???
这样我就可以调整每个尺寸(北、东、西、南、中)的大小。
谢谢
【问题讨论】:
标签: java swing layout border jsplitpane
因此,您实际上并不需要 BorderLayout。您可以将拆分窗格添加在一起以获得该效果。因为JSplitPane只支持拆分2个组件,所以需要垂直2个JSplitPane,在第二个垂直JSplitPane内需要2个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);
【讨论】: