Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Likes 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
brain-washing

microsoft says, and the sheep follow
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:brain-washing

microsoft says, and the sheep follow


Yay!
 
Rose Ellis
Greenhorn
Posts: 16
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
chris webster
Bartender
Posts: 2407
33
Linux Oracle Postgres Database Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or you could use Groovy's Swing Builder!
 
Rose Ellis
Greenhorn
Posts: 16
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic