我发现,可以通过将组件的最小尺寸设置为
new Dimension(),然后设置分隔线的位置来折叠拆分窗格的一侧:
// Hide left or toppane.getLeftComponent().setMinimumSize(new Dimension());pane.setDividerLocation(0.0d);// Hide right or bottompane.getRightComponent().setMinimumSize(new Dimension());pane.setDividerLocation(1.0d);
您可以使用这些设置来存储和恢复折叠/展开状态。



