4

They have this very cool drag and drop thing that creates GUI on the fly. But I don't get to learn anything out from this method and I feel guilty about it. Do most of the Java programmers use this method? Because realizing the code it generates, it's quite impractical coding the GUI by hand IMO.

2
  • Someone voted this as subjective and argumentative, but I don't think it is. If it gets closed, I'll probably vote to reopen if I catch it. Commented Jul 19, 2010 at 22:40
  • Yeah, I've found this post: stackoverflow.com/questions/3270771/… and has opened my eyes way ahead of time, since I am about to start learning Swing. I will do some more research whether Swing is still a viable toolkit for Java GUI, or other better options. Commented Jul 20, 2010 at 0:34

2 Answers 2

6

There's nothing wrong with using a GUI builder, as long as you understand what the tool is doing and the implications of using the tool of choice.

The first thing you need to know is what the tool is doing. In this case, you should understand Java Swing and topics such as layout managers, components, concurrency issues that arise when using Swing (this will be handy even when using a tool), event listeners and handlers. Really, you should be able to walk through a simple tutorial, such as this one on Creating a GUI with JFC/Swing. You don't need to be an expert, but you do need to be at least comfortable with reading the generated code and understanding what it does.

The second thing you need to be aware of is the implications of using whatever GUI building tool that you are using. A big implication is that if someone goes to edit the GUI code, they will have to either use your tool or edit the code by hand. If you work in an environment where people are using multiple IDEs and code editors, then someone who uses a different tool then you won't be able to work with your generated code without breaking your ability to use the tool. Most generators lay out their code in a specific manner so that it can be read and processed by the tool - different GUI builders generate different code and won't be able to easily work with each other's code. Also, because of this, editing the code by hand might break the ability of a GUI builder to work with the generated code.

If you understand the tool, what it does, and are willing to accept the risks, go for it. I'm a firm believer in using whatever tools are appropriate to get the job done and that includes GUI builders.

Sign up to request clarification or add additional context in comments.

Comments

2

Coding Swing by hand isn't bad at all once you get a grip on layout managers, so it all depends on whether you want to learn Swing. Knowing Swing is far from necessary but it is a pretty well designed bit of code.

1 Comment

Thanks. But do you think it is still worth learning Swing right now to be able to code it by hand or should I just rely on tools like Netbeans offer? I have read this post from this guy :stackoverflow.com/questions/3270771/… , but I am still not 100% convinced it's true, but somehow it is a thought to consider. What do you think?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.