Example usage for javax.swing JSplitPane getDividerSize

List of usage examples for javax.swing JSplitPane getDividerSize

Introduction

In this page you can find the example usage for javax.swing JSplitPane getDividerSize.

Prototype

public int getDividerSize() 

Source Link

Document

Returns the size of the divider.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JButton leftComponent = new JButton("left");
    JButton rightComponent = new JButton("right");

    JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftComponent, rightComponent);
    int size = pane.getDividerSize();
    size = 1;/*from  w w w . jav  a2  s .co m*/
    pane.setDividerSize(size);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JButton leftComponent = new JButton("left");
    JButton rightComponent = new JButton("right");
    JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftComponent, rightComponent);

    int loc = pane.getDividerLocation();

    loc = (int) ((pane.getBounds().getWidth() - pane.getDividerSize()) / 2);
    pane.setDividerLocation(loc);/*from w  ww. java 2  s . c o  m*/

    double propLoc = .5D;
    pane.setDividerLocation(propLoc);
}

From source file:Main.java

public static float getDividerProportion(JSplitPane splitPane) {
    if (splitPane == null)
        return 0;

    int size = splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ? splitPane.getWidth()
            : splitPane.getHeight();/*w  w  w  .  j  a  v  a2  s . c om*/
    int divLoc = splitPane.getDividerLocation();
    return size == 0 ? 0 : (float) divLoc / ((float) size - splitPane.getDividerSize());
}

From source file:org.ngrinder.recorder.Recorder.java

/**
 * Create a split pane with the give left and right components.
 * //from  w ww.  j  a  va 2  s.  co m
 * @param left
 *            component located in left
 * @param right
 *            component located in right
 * @return JSplitPane instance
 */
protected JSplitPane createSplitPane(final JComponent left, final JComponent right) {
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, left, right);
    splitPane.setDividerLocation(
            splitPane.getSize().width - splitPane.getInsets().right - splitPane.getDividerSize() - 200);
    splitPane.setResizeWeight(1);
    splitPane.setMinimumSize(new Dimension(600, 600));
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerSize(10);
    return splitPane;
}