Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Grid layout

 
Gautam Sewani
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In this code,a layout manager of 3 rows and 1 column is created and 5 buttons are added to it.
When I run this application,I find 3 buttons in the first row,and 2 buttons in the second with the space for a third button left.Now I understand why this happens,its because GridLayoutManager is row major and it has to strictly adhere to the number of rows specified,unless it is 0.But couldn't it have placed four buttons in the top row and 1 in the 2nd row.How will we determine how many buttons are placed in the top row and how many in the bottom row?
 
Jamal Hasanov
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Gautam
I think, this link may help you
Layout Managers
P.S. I studied LayoutManagers from this site during my SCJP prep.
Regards,
Jamal Hasanov
www.j-think.com
 
Arun Pai
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gautam,
Your last chance don't forget to check javacertstudy in yahoo groups(Treasure is not hidden - open source code in messages section). Good Luck for your Exams Tomorrow.

-Arun
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic