Code GUI by hand or Builder tool? What do you preffer?

I am asking a question which I had in my mind for a long time. I use netbeans IDE but I have never used it to build the GUI with its drag and drop features. So, I always build the GUI by hand. Up to now I thought it is the best way until I saw oracle is recommending building GUI via a builder tool in some cases (Read the NOTE section of here). So I have the following questions to ask.

1. What is the best way to build GUI? Builder tool or by hand?
2. How companies build GUI in their programs? Using a Builder tool or by hand?
3. How do you create GUI?
4. If builder tool can do it, why we code by hand unless otherwise it is not about getting experience in GUI?

> 1. What is the best way to build GUI? Builder tool or by hand?
with your fingers

> 2. How companies build GUI in their programs? Using a Builder tool or by hand?
whatever way the boss wants

> 3. How do you create GUI?
fingers

> 4. If builder tool can do it, why we code by hand...
builder-generated code is extremely difficult to follow.
write a program to display "Hello World" in a JOptionPane,
now do the same using a builder - compare the codes.
Have a go at modifying any GroupLayout code - good luck.

Michael Dunn wrote:> 1. What is the best way to build GUI? Builder tool or by hand?
with your fingers

> 2. How companies build GUI in their programs? Using a Builder tool or by hand?
whatever way the boss wants

> 3. How do you create GUI?
fingers

> 4. If builder tool can do it, why we code by hand...
builder-generated code is extremely difficult to follow.
write a program to display "Hello World" in a JOptionPane,
now do the same using a builder - compare the codes.
Have a go at modifying any GroupLayout code - good luck.

Nice answer, and a +1 from me too. But if we talk talk about .NET, why most of the .NET programmers never code the GUI by hand? Why most .NET companies are asking for experience in visual studio IDE? Are all of these hard work only for Java?
In case of Java, I know an institute, they never teach students how to code by hand. why is that?

Not sure what you mean by the word 'best' here. If you don't care about the code readability then using builder might be faster (although I strongly disagree)

2. How companies build GUI in their programs? Using a Builder tool or by hand?

My current project uses eclipse rcp which has a window builder. I was advised to use it by my team leader. However I proved that I am much faster at 'building' with my hands.

3. How do you create GUI?

I prefer coding the UI myself

4. If builder tool can do it, why we code by hand unless otherwise it is not about getting experience in GUI?

I personally think that the code is much cleaner and also after coding a few similar screens you might notice that a lot of functionality can be factored out into a common factory which then would be reusable elsewhere. The builder, however, repeats the same code which would then need to be fixed anyway. So why waste time in the first place

If a cluttered desk is a sign of a cluttered mind, then what are we to think of an empty desk?
[Albert Einstein] - or just another way to justify my mess

Yohan Weerasinghe wrote: But if we talk talk about .NET, why most of the .NET programmers never code the GUI by hand? Why most .NET companies are asking for experience in visual studio IDE? Are all of these hard work only for Java?

Well, one big advantage (if I can call that) that Microsoft guys have is: their code will or is expected to run only on Windows systems. So, when they build the system and test it, there are almost no challenges for them. In Java terms, they can happily use even 'null' layout!

Yohan Weerasinghe wrote:In case of Java, I know an institute, they never teach students how to code by hand. why is that?

They are lazy. While teaching/learning, going thru the harder way is the best way.

The right test for a GUI is - how it handles resize of windows and how similar it is across platforms.

And about your earlier question, I prefer to use NetBeans for professional projects. This is because, it is not just the layout, but there are other advantages too. I can quickly do beans binding from NetBeans, for example. And NB has good i18n support for Swing too. As for the GUI, I think I am slightly faster when using NB. However, I have also to add that, I still use 'nested' layouts with GridBag, Flow and Border being my preferred layouts. I almost always avoid the 'GroupLayout' churned out by default by NB. This way, I am actually not 'dependant' on the builder. Anytime, I can build the same GUI by hand as I know exactly how my screen is laid out.