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 best layout manager for a container Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "best layout manager for a container" Watch "best layout manager for a container" New topic
Author

best layout manager for a container

Paul Chamsay
Ranch Hand

Joined: Feb 06, 2009
Posts: 36
Hi guys,

I'm just wondering what is the best layout manager to use when you're going to code everything (including layout) manually? It is done through a JApplet, not sure if that matters..

It has LOTS of components and to cut it short, we were only taught how to use GridLayout, FlowLayout, and BorderLayout. If I'm going to code the whole program using these layouts and lots of panels, I'll probably need 30-50 panels in order to finish it.

I've been looking around and I saw this page where Sun recommends GridBagLayout if you're going to code manually. Seems a bit complex but if it will make my task easier, I wouldn't mind learning it. http://java.sun.com/docs/books/tutorial/uiswing/layout/gridbag.html



Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
generally, there's no 'one layoutManager fits all' - often this means nesting layouts (each for a particular strength).
gridbaglayout is very versatile, but, to use it well, it's learning curve is very steep.

30-50 panels? if each is a different screen, I hope your applet supplies coffee
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
I have to second what Michael has told you. Most layouts can be accomplished easier and faster by nesting layouts in multiple containers and avoiding GridBagLayout unless necessary. One thing that intrigues me though, and that I've yet to try is the MiG Layout manager that's not part of core Java, but is available (I believe free) here: MiG Layout Manager
Paul Chamsay
Ranch Hand

Joined: Feb 06, 2009
Posts: 36
Thanks for the advice!

@Michael

30-50 panels on one single screen, so no need for coffee (as of now)

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: best layout manager for a container
 
Similar Threads
GUI Problem - JLayeredPane with GridBagLayout
Scrolling BIG Images
Can't bind JComponent location to Jlabel text property
JScrollPane knob won't change size
size of JButton