I’m somewhat new to Swing programming, and I find that as much as I love the power of GridBagLayout, if you’ve got a lot of components, there are lots of lines of code just setting up the constraints for the layout. What are some good ways to keep this under control, besides using a visual editor?
Share
I feel your pain. I feel it so much, that I have recently abandoned GridBagLayout entirely, in favor of another tool – JGoodies Forms. Its layout code is more concise, reads at a higher level, and is in general much more satisfying to use than GridBagLayout.
It defines a mini-language to define layouts. It’s cryptic at first glance, but don’t let that discourage you.
If you are able to use it in your environment, I would highly recommend it.