Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

buttons in card layout

 
Stephanie Grasson
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 477
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic