Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Layout Managers

Status
Not open for further replies.

milage

Programmer
Jul 13, 2001
58
US
I was just wondering for typical forms with basic controls such as buttons and text boxes which is the best Layout Manager to use, if any at all?

As far as I can tell none of them seem to be that good at laying out many componenents on a form in the exact places where you want to put them, apart from possibly the GridBag layout but this does seem very complicated to use!

Is is best to use absolute position of components with no layout manager? Is so does this have any impact on application size or performance?

 
I think the key to remember is that you do not have to use just one layout manager for one screen, layout managers can be used by JPanels and so sub layout management is possible with multiple panels (containing multiple components) existing on one screen.

As for the best layout for the screen in general. Grid Bag layout is generally agreed upon as being one of the most flexible, but there is also Box layout which is fairly versatile. The trouble is they are more complex to use.

I have a gui with about 20 different JPanels on it, all using a variety of layout managers, but at the end of the day have also found that borderlayout provides a versatile layout manager for all these panels and sub panels to sit on at the highest level.

Screen design is not an easy process and I would certainly recommend sitting down with a pen and paper and seeing which screen elements can be put together with which LM.

best of luck.
bruce21.jpg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top