Here you can find the source of setNewHeightRatio (JSplitPane splitPane, JComponent comp, float oldFraction, int v1, int v2)
static public void setNewHeightRatio (JSplitPane splitPane, JComponent comp, float oldFraction, int v1, int v2)
//package com.java2s; import javax.swing.*; public class Main { static public void setNewHeightRatio(JSplitPane splitPane, JComponent comp, float oldFraction, int v1, int v2) { int h = comp.getHeight(); splitPane.setDividerLocation(//w ww . j a va 2 s. co m (int) ((oldFraction <= 0.01) ? v1 * h / v2 : splitPane.getHeight() * oldFraction)); } }