Java Code Examples for javax.swing.JSplitPane#resetToPreferredSizes()

The following examples show how to use javax.swing.JSplitPane#resetToPreferredSizes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnnotateScreenCapture.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private JSplitPane createSplitPane() {
    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    splitPane.setOneTouchExpandable(true);
    splitPane.setLeftComponent(new JScrollPane(imagePanel));
    splitPane.setRightComponent(getAnnotationPanel());
    splitPane.resetToPreferredSizes();
    return splitPane;
}
 
Example 2
Source File: PSheet.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Overridden to handle our layout requirements
 */
public void doLayout() {
    Component[] c = getComponents();

    if (c.length > 0 && getWidth() >= 0 && getHeight() >= 0) {
        Insets ins = getInsets();
        c[0].setBounds(ins.left, ins.top, getWidth() - (ins.right + ins.left), getHeight() - ins.top + ins.bottom);

        if (c[0] instanceof JSplitPane && Boolean.TRUE.equals(firstSplit)) {
            JSplitPane pane = (JSplitPane) c[0];
            pane.setDividerLocation(0.80f);
            pane.resetToPreferredSizes();

            JComponent dc = findDescriptionComponent();

            if (dc != null) {
                if (dc.getHeight() > 0) {
                    firstSplit = Boolean.FALSE;
                }
            } else {
                firstSplit = Boolean.FALSE;
            }
        }

        if (c.length > 1) {
            throw new IllegalStateException("Hmm, something is wrong: " + Arrays.asList(c));
        }
    }
}