This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes Question about programming style Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Question about programming style" Watch "Question about programming style" New topic
Author

Question about programming style

Greg Ferguson
Ranch Hand

Joined: Jun 04, 2012
Posts: 34
When creating a gui application or an applet, is there a standard about the best way to set up the code? For example, is it better to layout the code like this?

or like this:
Gaurangkumar Khalasi
Ranch Hand

Joined: Jun 02, 2012
Posts: 186
Don't know about the standard but prefer this one...

Buenny Fry wrote:
dennis deems
Ranch Hand

Joined: Mar 12, 2011
Posts: 808
I can think of good reasons to prefer either. I'm not aware of a standard though. The important thing is to be consistent.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19214

I prefer the solution that uses a proper layout manager


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Jordan D. Williams
Ranch Hand

Joined: Jan 03, 2012
Posts: 51

Rob Spoor wrote:I prefer the solution that uses a proper layout manager


What do you mean by that? (A beginner Java guy here...)

Thank you.


John 3:16
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19214

http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html
Greg Ferguson
Ranch Hand

Joined: Jun 04, 2012
Posts: 34
Thanks for your replies. I wasn't sure if there was a standard, but I definitely agree about being consistent with whichever style is chosen. And thanks for that informative link Rob. I've already run into how complex using layout managers can be -- especially when you start combining them -- but that site helped me understand them better.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19214

You're welcome
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: Question about programming style
 
Similar Threads
JPanels with different content should have the same size
It doesnt see my 'if' statements
Blank Frame or Panel
JScrollPane: Change of the size of content
Reference Specific Line in Text File