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

Khalid 's qn

 
Ann , Varghese
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
LayoutManager layout = new GridLayout(3,2);
Maybe like this?
Nick
 
Travis Gibson
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Ann , Varghese
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks for your reply, can someone confirm the answer for the above qn. I am not really sure.
 
Mary Chaddi
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats correct.
Rgds
Mary Chaddi

[This message has been edited by Ajith Kallambella (edited November 06, 2000).]
 
Sasikanth Malladi
Ranch Hand
Posts: 175
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic