0

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?

kleopatra
  • 51,061
  • 28
  • 99
  • 211
Nikola Luburic
  • 133
  • 1
  • 3
  • 10

1 Answers1

1

This can easily be done by doing the following:

splitPane.setDividerLocation(-1);
James A Mohler
  • 11,060
  • 15
  • 46
  • 72
Nikola Luburic
  • 133
  • 1
  • 3
  • 10