I am doing an online course in Java. Mainly for Windows Applications using Eclipse.
In the course that I m doing the Instructor has said that most Java programmers dont bother with GUI builders and tend to hand code everyhing. Is this correct? I ask because my previous language I made good use of a GUI builder due to its ease and speed.
Is this because the code is more stable than the generated code offered by GUI builders in Java or is it just better to have full control and to gain a better understanding on how it all works with the layout managers?
Another factor might be that many Java developers work on n-tier web applications with a browser-based UI, where Java-specific GUI builders are less practical and web tools/libraries are more appropriate.
I use a builder. The fact that NetBeans includes such a nice Builder suggests that other people use a builder too. Here is why I use it.
Even though my UIs are fairly simple, it is easier to visualize what I want with an editor. Otherwise I need to lay it out on paper first, and then generate a layout from the paper version. If I am going to lay it out on paper, I might as well lay it out in the GUI editor. Then once I get it laid out, it is done. If I do it manually then I find that when I am finished, nothing looks quite right and I go looking for the missing set of curly braces.
Even though my menus are simple, and construction of a menu is not terribly difficult in any case, the builder still comes in handy. Somee of my apps are not only cross platform but also multilingual. That means that every menu item, every tool tip, and every label or button, needs to be loaded with text from a resource bundle. I find the process of making the resource bundle calls to be terribly tedious. The GUI builder does all that for me.
Finally, I need to hook up the action call backs. Again, it is not difficult code, but it is boiler plate. I and choose not to bother doing it manually.
It probably pays to make a few simple programs without the GUI editor. Just to prove to yourself that you know what the editor is doing for you. But I wouldn't recommend that you become an expert in doing that sort of thing unless you find a specific need (like you work in an environment where a GUI editor would be a problem).
The only real down side to using a GUI editor is that they often have some additional files besides the pure java file that they generate for you. If those additional files get messed up, you can't edit your document anymore. Nor do you have an easy way to regenerate form files from the generated .java files. YOu could manually control the UI files from that point forward, but generated java files are not fun to work with. Case in point. NetBeans recently removed support for GUI builder from the IDE. It only affects Swing Applications Framework (aka SAF or JSR-296) which had been deprecated for a few years. Nonetheless I have several applications that started using that framework from before it was deprecated. So I now find myself in the situation of having a bunch of generated interface files that are hard to edit by hand, but for which I no longer have an GUI editor.
I've used a GUI builder plugin to Eclipse called Jigloo for 8 years now. I greatly simplifies laying out and editing my swing applications. It does not use an auxiliary file, only your Java file. I'm wondering if its lifespan is coming to an end though, I couldn't get the plugin to work with Luna but it does work with Kepler. I'm hoping they'll release a Luna compatible version. If Jigloo were to die I'd still have my Java files which I can continue to edit.
You may want to try another approach.
Traditional gui builders tend to generate ugly code.
Doing everything manually is time-consuming.
Generating the gui through reflection and customizing it may be a better solution.
posted 1 week ago
O. Tankoano wrote:. . . Generating the gui through reflection and customizing it . . .
Please explain why you think that; reflection is usually of not use to a beginner. Please don't simply advertise your framework in your reply.