用SWING写了一个界面,整个是一个JSplitPane,分为左右两部分,左边是一棵导航树,右边又是一个JSplitPane,分为上下两部分。每次启动后点击左边导航树节点,更新右边上下的界面,最小化后再最大化就只剩下右下角的界面。请高手指点。
部分代码:private void refreshUI() { rightPane.removeAll();
rightPane.add(settingPanel, JSplitPane.TOP);
rightPane.add(listPane, JSplitPane.BOTTOM);
rightPane.setDividerLocation(200);
rightPane.setDividerSize(3); mainPane.removeAll();
navPane = new JScrollPane(this.navTree);
mainPane.add(navPane, JSplitPane.LEFT);
mainPane.add(rightPane, JSplitPane.RIGHT);
mainPane.setDividerSize(3);
mainPane.setDividerLocation((int) (screen.width / 5.5));
this.add(mainPane);
this.setPreferredSize(new Dimension(screen.width, screen.height - 30));
this.setTitle("测试");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
this.setResizable(false);

this.pack();
}