This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "which is correct?" Watch "which is correct?" New topic
Author

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.
Thanks
Ash
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.
Bosun


Bosun (SCJP, SCWCD)
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.
Regards,
Manfred.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: which is correct?
 
Similar Threads
actual GUI question on a job technical interview
BorderLayout
MindQ's Mock up Exam - q53
JPopupmenu
Components in each direction of a BorderLayout