Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Khalid 's qn Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Khalid Watch "Khalid New topic
Author

Khalid 's qn

Ann , Varghese
Greenhorn

Joined: Oct 16, 2000
Posts: 13
Hi all,
Write a line of code that declares a variable named layout of type LayoutManager and initializes it with a new object, which when used with a container can lay out components in a rectangular grid of equal-sized rectangles, 3 components wide and 2 components high???

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
LayoutManager layout = new GridLayout(3,2);
Maybe like this?
Nick
Travis Gibson
Ranch Hand

Joined: Oct 17, 2000
Posts: 100
I don't think this is right
Originally posted by Nick Riviera:
LayoutManager layout = new GridLayout(3,2);

Actually I thought the constructor for GridLayout was
GridLayout(int rows, int cols)
Therefore the rows would determine the vertical(i.e. height) and cols would determine the horizontal (i.e. width)
So I believe it should be stated:
LayoutManager layout = new GridLayout(2,3);
For 2 components high and 3 components wide which is just a different way of saying 3 components wide and 2 components high.
You agree?

Travis M. Gibson
Future SCJP(Nov. 19, 2000)

Regards,<BR>Travis M. Gibson, SCJP<BR>Java Developer<BR>www.travismgibson.com<BR>travis@travismgibson.com
Ann , Varghese
Greenhorn

Joined: Oct 16, 2000
Posts: 13
Hi,
Thanks for your reply, can someone confirm the answer for the above qn. I am not really sure.
Mary Chaddi
Greenhorn

Joined: Nov 01, 2000
Posts: 7
Thats correct.
Rgds
Mary Chaddi

[This message has been edited by Ajith Kallambella (edited November 06, 2000).]
Sasikanth Malladi
Ranch Hand

Joined: Nov 04, 2000
Posts: 175
Yes, travis is right. If you have some math background, you can remember this as a matrix, and in a matrix we always refer to the rows first and the columns next.
Regards,
Sashi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Khalid 's qn