|
However, there is one aspect of JSplitPane's default behavior which is lacking, yet easily addressed with a minor code change. By adding this line:
splitpane.setOneTouchExpandable(true);for each JSplitPane you create, you'll add two arrows to the splitter. The arrows let the user collapse the splitter completely in either direction. Without doing this the splitter will only collapse as small as the minimum size of the component being shrunk, which sometimes leaves the user wanting more.
After this quick change, either side of the splitter can be completely hidden. Then if the users want to see part of the splitter full-size, they can. Restoring the splitter to its original location is easy too, just use the arrow in the opposite direction.
This feature seems very valuable, I think it should be made the default behavior in a future version of Swing.
Copyright © 2024 Andrew Oliver