Reputation: 3193
I am planning to create application with swing. I have been using graphic tools for drawing components, but I have heard, that "coding" components is far more better. Why is that? Can someone explain me pros and cons of assembling UI with code and graphical editor?
Upvotes: 0
Views: 119
Reputation: 73558
Creating a simple UI is feasible with GUI builders, but as soon as you want something a bit more complicated, you realize that you can't read the code. You're dependent on the GUI builder, because the code is generated and unreadable (also you haven't written it, so you can't easily see what it's doing).
When something goes wrong or you need to debug a problem, you'll have a hard time trying to figure out where the problem is or how to fix it.
Upvotes: 2
Reputation: 88707
A graphical editor often simplifies creation of complex layouts but most of them create quite messy code or don't provide enough extension points to add custom code. Without those extension points, your custom code would be removed once you recreate the ui.
Writing Swing ui code directly isn't that hard if you use the layout managers correctly (don't do the layout yourself, i.e. don't manually set positions, sizes etc.).
However, there are still quite good graphical editors that generate reasonable code. So whether or not to use one depends on your requirements (custom code, development speed, readability), the Swing libraries used (just standard or additional layout managers like MiG layout) as well as which graphical editors you use.
Upvotes: 2