Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

best layout manager for a container

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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



 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the advice!

@Michael

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

 
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic