Java tutorial
//package com.java2s; //License from project: Open Source License import javax.swing.JSplitPane; public class Main { public static float getDividerProportion(JSplitPane splitPane) { if (splitPane == null) return 0; int size = splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ? splitPane.getWidth() : splitPane.getHeight(); int divLoc = splitPane.getDividerLocation(); return size == 0 ? 0 : (float) divLoc / ((float) size - splitPane.getDividerSize()); } }