File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GridLayout troubles

 
Aaron Parker
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone explain to me why when I run this code, I get 4 cols and 2 rows instead of 2 cols and 2 rows?




(Code tags added by Michael Morris)
[ April 23, 2004: Message edited by: Michael Morris ]
 
Craig Wood
Ranch Hand
Posts: 1535
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this line

you tell the GridLayout layout manager that you want two rows and two columns. It is expecting to be handed 2 x 2 = 4 components to layout in this 2 x 2 grid. When you hand it 8 components it tries to put them in 2 rows...
Check the last paragraph in the GridLayout api for the explanation.

From this explanation, a common practice that is used in GridLayout is to specify either rows or cols and let the layout manager use the (unspecified) number of rows or cols it needs. If I want only two columns I can do:
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic