File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Mock Exam Errata and the fly likes JQuest: Panel & Window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "JQuest: Panel & Window" Watch "JQuest: Panel & Window" New topic

JQuest: Panel & Window

yi miao

Joined: Jun 29, 2001
Posts: 6
You need a container to hold six equal-sized button in the three columns of two. This arrangement must persist when the container is resized. Which of the following will create that container?
A. Canvas c=new Canvas(new GridLayout(2,3));
B. Panel p=new Panel(new GridLayout(2,3));
C. Window w=new Window(new GridLayout(2,3));
D. Panel p=new Panel(new GridLayout(3,2));
Obviously, A & D are wrong, since Canvas is not a subclass of container, and D creates a GridLayout with 3 rows, 2 columns.
But I don't know what's the difference here between B & C? Why the correct answer is B, not C? Thanks.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Because Window doesn't have a constructor that takes a LayoutManager.
Tom - SCJP --- Co-Moderator of the Programmer Certification Forums

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
I agree. Here's the link:
subject: JQuest: Panel & Window
It's not a secret anymore!