JSplitPane divider location after resize from JFrame
This problem has vexed me for years. Go to the Sun splitpane tutorial:
http://java.sun.com/docs/books/tutorial/uiswing/components/splitpane.html
and use Webstart to run the first demo:
http://java.sun.com/docs/books/tutorialJWS/uiswing/components/example-1dot4/SplitPaneDemo.jnlp
I do the following:
1. Make the JFrame reasonably big
2. Drag the divider to the right a bit, maybe so the left component has 75% of the space and the right 25%.
3. Resize the JFrame so its width is lesser than the divider's location. When you finish resizing the JFrame, you'll see the divider has a new location. If the code's author had called:
Toolkit.getDefaultToolkit().setDynamicLayout(true);
you could actually see the divider bar moving location toward the left.
4. Now, resize the JFrame back to its size in step one. The divider location stays put, doesn't budge an inch.
I would love for the divider to also resize itself and move back to the location it had in step two. But, for some reason, the default behavior is to not do this. Splitpanes happily reset the divider location when you make the wrapping JFrame smaller but refuse to resize the divider location when you make the wrapping JFrame larger.
Can someone tell me how to solve this problem? I see that they have it working perfectly in Eclipse, the IDE itself. When you make the window smaller and the larger, everything resizes perfectly. SWT trick or something? What is the trick in Swing. Please be explicit as possible.
Thanks

