• Post Reply Bookmark Topic Watch Topic
  • New Topic

Which layout manager to use?

 
Barry Brashear
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am still a little confused on how to decide which layout manager to use.
If you have a dialog or panel that contains a form with several JLabels and
JTextFields throughout it, which layout manager is best to use.

Thanks.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on what you want to do. I suppose the best LayoutManager for a given situation is the one that lets you write the least code to accomplish your goal.

The real question, I think, is between two more complex alternatives: should you build up a complex GUI using several nested panels, each with its own LayoutManager; or should you use GridBagLayout, easily the most complicated LayoutManager, but the one which generally lets you avoid nested panels and do everything at one level?

Again, there's no one right answer. The best thing you can do as a novice is to use every layout manager and get a feel for its capablities and limitations. As you gain experience, you'll amass a whole "toolbox" from which you can pull the right tool for each application. But I really think there's no substitute for experience here.
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I find JGoodies Forms works very well for most situations and is pretty easy to use.
 
arunkumar sundar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suggest to use Gridbag layout.Though difficult,It is very flexible.

Thanks
Arunkumar
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!