本文整理匯總了Java中javax.swing.JSplitPane.setMinimumSize方法的典型用法代碼示例。如果您正苦於以下問題:Java JSplitPane.setMinimumSize方法的具體用法?Java JSplitPane.setMinimumSize怎麽用?Java JSplitPane.setMinimumSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JSplitPane
的用法示例。
在下文中一共展示了JSplitPane.setMinimumSize方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configureFirstComponent
import javax.swing.JSplitPane; //導入方法依賴的package包/類
private void configureFirstComponent() {
JSplitPane firstSplit = (JSplitPane) getFirstComponent();
int newWidth;
int newHeight;
newWidth = firstSplit.getMinimumSize().width;
newHeight = 0;
if (getFirstComponent(firstSplit).isVisible() && getSecondComponent(firstSplit).isVisible()) {
newHeight = getFirstComponent(firstSplit).getSize().height
+ getSecondComponent(firstSplit).getMinimumSize().height + firstSplit.getDividerSize();
} else if (getFirstComponent(firstSplit).isVisible()) {
newHeight = getFirstComponent(firstSplit).getMinimumSize().height;
} else {
newHeight = getSecondComponent(firstSplit).getMinimumSize().height;
}
firstSplit.setMinimumSize(new Dimension(newWidth, newHeight));
}
示例2: configureSecondComponent
import javax.swing.JSplitPane; //導入方法依賴的package包/類
private void configureSecondComponent() {
JSplitPane secondSplit = (JSplitPane) getSecondComponent();
int newWidth = secondSplit.getMinimumSize().width;
int newHeight = 0;
if (getFirstComponent(secondSplit).isVisible() && getSecondComponent(secondSplit).isVisible()) {
newHeight = getSecondComponent(secondSplit).getSize().height
+ (getFirstComponent(secondSplit).isVisible()
? (getFirstComponent(secondSplit).getMinimumSize().height + secondSplit.getDividerSize()) : 0);
} else if (getFirstComponent(secondSplit).isVisible()) {
newHeight = getFirstComponent(secondSplit).getMinimumSize().height;
} else {
newHeight = getSecondComponent(secondSplit).getMinimumSize().height;
}
secondSplit.setMinimumSize(new Dimension(newWidth, newHeight));
}
示例3: SmileDemo
import javax.swing.JSplitPane; //導入方法依賴的package包/類
public SmileDemo() {
super(new GridLayout(1,0));
//Create the nodes.
DefaultMutableTreeNode top = new DefaultMutableTreeNode("Smile");
createNodes(top);
//Create a tree that allows one selection at a time.
tree = new JTree(top);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
//Listen for when the selection changes.
tree.addTreeSelectionListener(this);
//Create the scroll pane and add the tree to it.
JScrollPane treeView = new JScrollPane(tree);
JPanel placeholder = new JPanel(new BorderLayout());
placeholder.setBackground(Color.white);
//Create the log pane.
logPane = new JTextArea();
logPane.setEditable(false);
JScrollPane logView = new JScrollPane(logPane);
redirectSystemStreams();
workspace = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
workspace.setTopComponent(placeholder);
workspace.setBottomComponent(logView);
workspace.setDividerLocation(700);
//Add the scroll panes to a split pane.
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPane.setLeftComponent(treeView);
splitPane.setRightComponent(workspace);
Dimension minimumSize = new Dimension(100, 50);
placeholder.setMinimumSize(minimumSize);
logView.setMinimumSize(minimumSize);
workspace.setMinimumSize(minimumSize);
treeView.setMinimumSize(minimumSize);
splitPane.setDividerLocation(300);
splitPane.setPreferredSize(new Dimension(1000, 800));
//Add the split pane to this panel.
add(splitPane);
}