aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes buttons in card layout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "buttons in card layout" Watch "buttons in card layout" New topic
Author

buttons in card layout

Stephanie Grasson
Ranch Hand

Joined: Jun 14, 2000
Posts: 347
Hi all!
This is from the mock exam at http://www.geocities.com/SiliconValley/Screen/5046/ftest1.html.
The question is:
Which of the following managers can be used to display nine button objects at one time?
1. BorderLayout
2. GridLayout
3. CardLayout
4. GridBagLayout
The "right" answer is 2&4.
I don't see why a CardLayout card could not have nine buttons on it. Could anyone please explain?
Thanks in advance.
Stephanie
Marcela Blei
Ranch Hand

Joined: Jun 28, 2000
Posts: 477
>I don't see why a CardLayout card could not have nine buttons
>on it. Could anyone please explain?
The API says...
A CardLayout object is a layout manager for a container. It treats each component in the container as a card. Only one card is visible at a time, and the container acts as a stack of cards. The first component added to a CardLayout object is the visible component when the container is first displayed.
First button isn�t a container so you can add a button directly to a CardLayout. Second a CardLayout show one element at a time (like a Tabbed Panel, when you select Tools-Options in Word!) and this element must be a Container like Panel, then, in that Panel you can specify a FlowLayout for placing the 9 buttons.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: buttons in card layout