Reputation: 153
I have a JSplitPane
that has a JTable
on the top part and a panel with labels and JTextFields
on the bottom part. The splitter is set before adding using this function:
splitPane.setResizeWeight(1.0);
Now, I have a button that "hides" the bottom panel with this code:
splitPane.setDividerLocation(splitPane.getHeight());
splitPane.setEnabled(false);
Basically you can see the splitter at the bottom (which is what I want) but you can't do anything with it. Now, how do I get it back to the default position (the one giving the bottom panel the room it needs)?
I know I could use this by memorizing the relative position of the splitter before I push the button, but is there any function that will "refresh" my splitter to the location it needs to be to fulfill the condition of the setResizeWeight(1.0)
function?
Upvotes: 0
Views: 176
Reputation: 153
This can easily be done by doing the following:
splitPane.setDividerLocation(-1);
Upvotes: 1