• 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
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Journal Article - Java Designs - Examining Layouts with Swing

 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The just-released September 2004 edition of The JavaRanch Journal includes an article by Tom Tolman, "Java Designs - Examining Layouts with Swing".

Please use this thread to comment on and discuss the article.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tom, I enjoyed reading your article. I do have something to say though. You said:

The second secret of using the standard layout managers is to exploit the constraints each provide you.

I think one of the major complaints about Swing LayoutManagers is there is little to no documentation on what constraints each Layout utalizes and which ones are ignored. You touched on a few. So what would be the secret to find this information out?
 
blacksmith
Posts: 1332
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I second Gregg's question. (I suspect the answer is "through lots of experimentation", but I'm hoping there's a secret.)

Nitty comments:

It appears to me that the "Nested Panels" example looks good only because the pixel length of the words "First" and "Last" happen to be the same in the Windows look and feel in XP. I suspect the text input fields will not line up properly in other operating systems (including quite possibly other versions of Windows).

The article says, "Text entry areas should grow horizontally to allow more space to type." This is one of the things that often doesn't happen properly using defaults, depending on the layout manager. Possibly some information on how to do this would have been useful.

Good introductory article for those new to Swing, though.
 
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm sorry to disagree with Greg. I think swing layout is very easy to master once you understand the limitation of each layout manager. I program TK, and believe me, TK layout is about ten times worse.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Adrian Yan:
I think swing layout is very easy to master once you understand the limitation of each layout manager.



I didn't say they were hard. And yes, I am sure that once you understand the limitation of each layout manager, they get even easier. What I said was:


I think one of the major complaints about Swing LayoutManagers is there is little to no documentation on what constraints each Layout utalizes and which ones are ignored.



What is hard is getting that initial understanding because there is hardly any documentation to provide you with what constraints on a component each LayoutManager uses and which ones they ignore. That's what I said.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic