1、创建和初始化
//Create a split pane with the two scroll panes in it.
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
listScrollPane, pictureScrollPane);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(150);
//Provide minimum sizes for the two components in the split pane
Dimension minimumSize = new Dimension(100, 50);
listScrollPane.setMinimumSize(minimumSize);
pictureScrollPane.setMinimumSize(minimumSize);
2、设置组件
setLeftComponent
setRightComponent
setTopComponent
setBottomComponent
3、定位分隔条DIVIDER以及限制分隔条范围
默认情况下splitPane的首选尺寸和分隔条的位置由放置其中组件的决定,以保证组件都处于其首选尺寸。
本文介绍了如何使用Java Swing中的JSplitPane组件创建水平分割面板,并设置了两个滚动面板作为其子组件。文章详细解释了如何初始化JSplitPane、设置子组件的最小尺寸及调整分隔条位置等操作。
2910

被折叠的 条评论
为什么被折叠?



