List of usage examples for javax.swing JSplitPane getBounds
public Rectangle getBounds()
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); }