wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Code GUI by hand or Builder tool? What do you preffer? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Code GUI by hand or Builder tool? What do you preffer? " Watch "Code GUI by hand or Builder tool? What do you preffer? " New topic
Author

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

Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Hello all,

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?

Please answer. Thanks.


Are you better than me? Then please show me my mistakes..
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> 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.
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

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?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
brain-washing

microsoft says, and the sheep follow
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Michael Dunn wrote:brain-washing

microsoft says, and the sheep follow


Yay!
Rose Ellis
Greenhorn

Joined: Jun 08, 2012
Posts: 16

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

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
chris webster
Bartender

Joined: Mar 01, 2009
Posts: 1873
    
  16

Or you could use Groovy's Swing Builder!


No more Blub for me, thank you, Vicar.
Rose Ellis
Greenhorn

Joined: Jun 08, 2012
Posts: 16

chris webster wrote:Or you could use Groovy's Swing Builder!


I'll think about it the next time I'm using swing
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

chris webster wrote:Or you could use Groovy's Swing Builder!


Thanks for the reply. But, then, GUI in one IDE, other parts are in another IDE, because I prefer netbeans! :O
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1096
    
  10

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.
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1096
    
  10

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Code GUI by hand or Builder tool? What do you preffer?