Procedure
This scenario
will test out the features and behavior of the BoxLayout 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
BoxLayout(X_AXIS)
Basic Canvas Manipulation
Choose a
JButton from the palette and drop it (without sizing) onto the JPanel.
Verify the JButton is its
default size and positioned on the far left horizontally on the JPanel,
and the middle vertically.
Set the text of
the JButton to "Button" on the Property Sheet (PS)
Select the
JButton on the panel, and move the cursor around the border of the
button
Verify the cursor changes
to Move, and not Resize.
Verify the move dots
(corners) but not the resize dots (middle) are shown on the border of
the button.
Choose another
JButton from the palette and mouse to the right of the JButton on the
panel but do not drop.
Verify a vertical black
bar indicating the drop position is shown to the right of the JButton.
Move the cursor
to the left of the button
Verify the vertical black
bar is shown to the left of the JButton. (may be hard to see with
border of JPanel)
Drop the
JButton anywhere on the panel to the right of the existing button.
Verify the new button is
placed directly alongside on the right of the existing button.
Select the new
button and set the maximumSize property to 100,100.
You may need to press the "Show Advanced Properties" button on the
property sheet to see the maximumSize property.
Verify the button is
resized to its maximumSize on the canvas.
Choose a
JTextArea from the palette and drop it to the right of the last button.
Verify the text area takes
up all the remaining space on the JPanel to the right of the buttons.
Verify the second button
is squished graphically back to its default width.
Select the
second button and change it's preferredSize to 100,100 on the PS.
Verify the second button
resizes to its preferred size on the canvas.
Click and drag
the text area over the JPanel.
Verify the vertical black
positioning bar indicates a drop position for all areas of the JPanel.
Drop the
JTextArea between the two buttons
Verify the components
rearrange properly.
In the Beans
View, click and drag the first JButton below the JTextArea.
Verify the components
rearrange properly.
Note: The following test is specific to
JDK 1.3 only and is not supported in JDK 1.4
Click on the JPanel and change the componentOrientation property to
RIGHT_TO_LEFT on the PS.
Verify the components are
reordered from right to left.
Alignment
Delete the
JTextArea and drop a JLabel
Choose each
component on the JPanel and set the alignmentY property on each to be
1.0
Verify the components are
aligned to the bottom of the JPanel.
Choose each
component on the JPanel and set the alignmentY property on each to be
0.0
Verify the components are
aligned to the top of the JPanel.
Change the
components alignmentY (need to toggle the advanced properties)
properties to different values between 1.0 and 0.0.
Verify the components are
aligned relative to each other according to the assigned values
Y Axis
Select the
JPanel and change the layout to BoxLayout(Y_AXIS)
Verify the components are
moved to the top left corner of the JPanel.
Drag a
component over the JPanel
Verify a horizontal black
bar indicating the drop position is shown at all possible drop
positions.
Drop a
JTextArea on the JPanel.
Verify the text area
expands to fill the available space in the panel.
Conversions to BoxLayout
For each layout
other than BoxLayout
Various Tests
Open
HorizontalBoxLayoutPage.java, VerticalBoxLayoutPage.java and
XAlignmentBoxLayoutPage.java
from swing_layoutmanagers.zip
Verify each appears
correctly.


