File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes which is correct? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "which is correct?" Watch "which is correct?" New topic

which is correct?

Ash sav
Ranch Hand

Joined: Apr 14, 2001
Posts: 55
53. A component that should resize vertically but not horizontally should be placed in a:
a) BorderLayout in the North or South location
b) FlowLayout as the first component
c) BorderLayout in the East or West location
d) BorderLayout in the Center location
e) GridLayout
I think answer is a. If I'm wrong please correct me.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
You are correct, the answer is A. A Border layout honors the prefered height of ther North and South components, and forces them to be exactly as wide as the container. Components in the east and west region get to be their preferred width, but their height is constrained.

So much trouble in the world -- Bob Marley
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Ash,
You are wrong the correct answer to the question is 'C'.
Here's why! The questions says "should resize vertically".
A) As Bosun correctly stated the North/South locations of BorderLayout won't resize in the vertical direction, only in the horizontal direction.
B) FlowLayout won't resize in any direction because it honors preferred sizes of components.
C) BorderLayout East/West will resize in horizontal direction as the panel gets larger or smaller. This is because the East/West positions are stretched to fit fully between North/South positions.
D) BorderLayout Center will resize in both directions which doesn't answer the question correctly.
E) GridLayout all resizes in both directions with same explanation as D above.
I agree. Here's the link:
subject: which is correct?
jQuery in Action, 3rd edition