File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Question about programming style Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
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: 187
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: 19718
    
  20

I prefer the solution that uses a proper layout manager


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
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: 19718
    
  20

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: 19718
    
  20

You're welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about programming style