Procedure
This scenario will test
out the features and behavior of the CardLayout manager.
Setup
Create a new Visual Class extending JPanel and resize it to take up 3/4ths of
the Canvas. Set the layout of the JPanel to CardLayout
Basic Canvas
Manipulation
Choose the JTable bean
on the palette and drop it on the JPanel.
Verify
that the JTable is displayed properly, taking up all the space of the JPanel.
Verify
the initialization method of the JTable sets the name property.
Verify
the add call on the JPanel passes in the getJTable().getName() as the constraint
(second parameter).
Choose the JTree bean
on the palette and drop it on the JPanel (can not drop it on top of the JTable),
use the JavaBean viewer.
Verify
that the JTree is displayed properly, taking up all the space of the JPanel, in
front of the JTable.
Click on the JTable in
the Beans View.
Verify
that the JTable is brought to the front.
Choose the JOptionPane
bean on the palette and drop it between the JTable and JTree on the Beans View
Verify
that the JOptionPane is displayed properly, on top of all others, taking up all
the space of the JPanel
Click and drag and drop
a bean in the Beans View to reorder the beans.
Verify
that the order of the add statements are changed.
Verify
that the first bean on the JPanel is shown on top
Property Sheet
Select the JPanel
Verify
that the Layout property on the PS gives a value representing the CardLayout
Verify
there's a + to expand the sub-properties of the Layout - hgap and vgap
![]()
Verify
that changing the hgap and vgap properties update the source and the canvas
correctly (creates space on the edge of the cards).
Change the hgap and
vgap properties in the source (select on the given property, and make sure the
corresponding expression is selected in the source pane).
Verify
the changes are reflected in the PS and on the canvas
Change the ordering of
the adding of components from the source.
Verify
the new order shows up in the Beans View and that the first component is brought
to the front on the canvas.
Switching from Cards that have Grids
Choose another JPanel
bean on the palette and drop it on the JPanel with a CardLayout and
drop 3-4 components (e.g. JButton,
JCheckBox, JRadioButton, JSlider) onto it in the Beans Viewer.
In the property sheet,
change the layout from a FlowLayout to a null layout.
MB2 over the JPanel and
select Show Grid. This will display a dotted grid.
In the Beans view,
select a different card.
Verify
that switching to another card hides the grid.
From the Beans view,
select the JPanel with a null layout again. Note... the grid does NOT redisplay
until you select Show Grid again. This is WAD.
Conversions to CardLayout
For each layout other
than CardLayout