In a JSplitPane, you have the setOneTouchExpandable method which provides you with 2 buttons to quickly fully hide or full show the JSplitPan
JSplitPane
setOneTouchExpandable
JSplitPan
You can simply use this:
public void setDividerLocation(double proportionalLocation) splitPane.setDividerLocation(0.0d);
or.
splitPane.setDividerLocation(1.0d);
depending on wheter yourwant to hide the left component first or the right component.