Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Journal Article - Java Designs - Examining Layouts with Swing

 
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.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • 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?
 
blacksmith
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.
 
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
Mac OS X IntelliJ IDE Chrome
  • 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.
 
Yes, of course, and I accept that blame. In fact, i covet that blame. As does this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!