This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
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
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
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.