Procedure
This scenario will test
out the features and behavior of the BorderLayout 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 BorderLayout.
Basic Canvas Manipulation
Choose a JButton from
the palette and hover over the JPanel.
Verify
that the regions of the border layout are outlined in green, and that moving
over them highlights the region and displays the label of the region.

Drop the JButton in the
North region.
Verify the
component is its default height and takes up the entire width of the JPanel.
Select the JButton
Verify that
the cursor indicates the bean can be moved, but not resized (no resize handles)
Click and hold the
JButton.
Verify the
other regions are highlighted when the mouse moves over them, but North remains
blank.
Verify that
releasing over North is possible, and doesn't affect the code or the canvas.
Click and drag the
JButton to the East region.
Verify
the component is its default width and takes up the entire height of the JPanel.
Click and drag the
JButton to the South region.
Verify
the
component is its default height and takes up the entire width of the JPanel.
Click and drag the
JButton to the West region.
Verify
the component is its default width and takes up the entire height of the JPanel.
Click and drag the
JButton to the Center region.
Verify the
component takes up the entire height and width of the JPanel.
Move the JButton back
to the North position, and change it's text to read "North" - use the PS, undo,
and use the Source.
Select another JButton
from the palette and hover over the JPanel.
Verify the
North region is darkened and when the mouse hovers over North the region does
not become highlighted and the cursor changes to the Not cursor.

Attempt to drop the
JButton on the North region.
Verify
that no changes are made on the canvas and in the source. The cursor is no
longer loaded with the JButton.
Select JButton again on
the palette and drop it in the East region.
Verify
the component is its default width and takes up the rest of the height of the
JPanel less the height of the North component.
Change the text of the
East button to read "East" - use direct Edit on the JavaBean tree.
Click and hold the East
button.
Verify
that only the West, Center and South regions are highlighted when hovered over.
Drop the East Button in
the North region.
Verify
the East and North buttons exchange locations and are resized properly.
Switch the East and
North buttons back to their correct positions.
Choose another JButton
and hover over the JPanel.
Verify
that the North and East regions are shadowed and disabled.
Drop the JButton in the
Center region
Verify
the component is takes up the rest of the space in the JPanel less the height of
the North component and the width of the East component.
Change the text of the
Center button to read "Center" - use direct Edit on the Canvas.
Drop a JButton on the
free form, and drag it over the JPanel.
Verify
that South and West are the only valid drop targets.
Attempt to drop on one
of the blocked regions.
Verify
that no changes occur.
Remove a few of the
JButtons and place an assortment of other components.
Place a JCheckBox in
the center region.
Verify
each component is sized and placed as expected.
Move the components
from one region to another graphically.
Verify
the moves occur successfully.
Property Sheet
Select the JPanel
Verify
that the Layout property on the PS gives a value representing the BorderLayout
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.
Select each component
on the JPanel
Verify
there's a Constraint property, and it's set to a valid BorderLayout constraint -
North, South, East, West, Center, After Line Ends, Before Line Begins.
Verify
the options shown on the Constraint combo are the empty positions only.
Verify
that changing the Constraint option moves the component to the new location
properly and updates the source correctly.
Move a component to the
East position if there's not already one there.
Move a component to the
West position if there's not already one there.
Set the constraint on
the East component to After Line Ends.
Set the constraint on
the West component to Before Line Begins.
Select the JPanel.
Change it's componentOrientation to RIGHT_TO_LEFT
Verify
that the East and West components have swapped places on the canvas.
Change the position
constraints in the source.
[ i.e. change
this.add(getJButton1(),
java.awt.BorderLayout.EAST); -> this.add(getJButton1(),
java.awt.BorderLayout.WEST); ]
Verify
the constraint change is reflected in the property sheet and from the source.
Change constraint
specification to use a string parameter in the source
[ i.e. change
this.add(getJButton1(),
java.awt.BorderLayout.EAST); -> this.add(getJButton1(),
"West"); ]
Verify
the constraint change is reflected in the property sheet and from the source.
Conversions to BorderLayout
For each layout other
than BorderLayout
Note: if there are more
than 5 components on the container then the layout is changed to BorderLayout,
any components over 5 will be removed. This is correct behavior for now.