Suppose you want to divide your JSplitPane horizontally with a 50-50% division, the first thing that usually comes to mind is to use the setDividerLocation() method. That is what I did, which did not work. Explanation aside, the easiest way to do this would be to first call setResizeWeight() with values between 0.0 to 1.0 representing 0-100%.
In this post, I set my JSplitPane to be divided 50-50% so I code it like this.
By calling setResizeWeight(), it is resized to fit the Container it is in. You can then call setDividerLocation() to have the desired result. One more thing. Try resizing or maximizing the window. You will notice that the call to setResizeWeight() will make the JSplitPane keep the same ratio ;).