• Post Reply Bookmark Topic Watch Topic
  • New Topic

Effective Layout with Swing

 
Parna Hiram
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on a fairly complex Swing GUI with a few different forms,
and having a thoroughly difficult time with it. While there are a
multitude of online resources that describe each of the layout
managers, I haven't been able to find one that helps you determine
best strategy. They present the layout manager with very simple
examples, but don't show you how to use it effectively to create a
real world GUI.

When to subdivide a main panel into smaller panels for grouping, some
common approaches to business form layout (BorderLayout containing
several panels, each with their own layout?), etc. I can't find
answers for any of these, or questions like them.

I've looked at all the well known managers, including those packaged
with the J2SE and others (JGoodie's FormLayout, TableLayout,
ExplicitLayout), etc. but all my forms continue to turn out ugly with
no flow. Yes, this probably indicates that my GUI design skills
aren't up to par, but I can't help feel that if I had a better
understanding of how/when to use certain layout managers *in concert*,
my creativity would be freed to really focus on making the design
better, and not the implementation. Should I throw up of hands and go
to a null layout?

Do any of you know of a good resource (book or site) that describes
how to take a design and implement it with a combination of layout
managers effectively? Or a site that breaks down common form patterns
(I suspect 40% of business/data entry forms follow very similar flow)
into Swing implementation?

Please thank you for your help.

Regards, Parna
 
Jared Cope
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I understand your pain. It can be fiddly to work out how all the layout code should go when you have the picture of the form design in your head but can't quite get there.

I have recently decided to cheat a little bit and have been looking into visual layout designers for Java swing. I am currently looking at JFrameBuilder from http://www.mars3000.com/. Of course you should know what all the generated code is doing, but I think its a valuable tool to get you to your goal.

I basically use it to generate the code, then copy paste it into my real application. This lets me focus on the important business code implementation, not the layout code.

Cheers, Jared.
 
Parna Hiram
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jared,

Thanks for the reply. I have WindowBuilderPro, which does an ok job. But you still need to understand how to combine layout managers in an efficient way.

Seems one could take a survey of 100 windows applications, generalize their layouts into common categories, and then demonstrate how to implement a general screen from each category with Swing. Perhaps that's what I'm looking for.

Thanks,
Parna
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only way I know of learning to use layout managers is trial and error. If you have a general layout that you want help with you could show what you want and we might be able to offer some useful suggestions.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!