当前位置: 首页>>代码示例>>Java>>正文


Java JSplitPane.setMinimumSize方法代码示例

本文整理汇总了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));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:JCompoundSplitPane.java

示例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));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:JCompoundSplitPane.java

示例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);
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:48,代码来源:SmileDemo.java


注:本文中的javax.swing.JSplitPane.setMinimumSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。