Example usage for javax.swing JSplitPane getBounds

List of usage examples for javax.swing JSplitPane getBounds

Introduction

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

Prototype

public Rectangle getBounds() 

Source Link

Document

Gets the bounds of this component in the form of a Rectangle object.

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 loc = pane.getDividerLocation();

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

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