In a JSplitPane
, you have the setOneTouchExpandable
method which provides you with 2 buttons to quickly fully hide or full show the JSplitPan
Working around the problem that setDividerLocation(1.0)
doesn't work until the frame has become displayable, one can use an AncestorListener
:
sp.addAncestorListener(new AncestorListener {
def ancestorAdded (event: AncestorEvent): Unit = sp.setDividerLocation(1.0)
def ancestorRemoved(event: AncestorEvent): Unit = ()
def ancestorMoved (event: AncestorEvent): Unit = ()
})