• Post Reply Bookmark Topic Watch Topic
  • New Topic

Journal Article - Java Designs - Examining Layouts with Swing

 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • 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.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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?
 
Warren Dew
blacksmith
Ranch Hand
Posts: 1332
2
  • Mark post as helpful
  • send pies
  • 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.
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • 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
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!