Expand JSplitPane Programmatically

Expanding a JSplitPane either to the left or right direction programmatically is actually easy if you know which component to look at. The split pane bar has a left and right arrow right? Those are actually buttons formed different within the BasicSplitPaneUI class.

Using the code below:

will expand the JSplitPane to the right and hide the right pane while showing the left pane in full. If you want to access the button that will hide the left pane instead while making the right pane visible, use the index zero inside the getComponent() method.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *