Help: Compass points


Help is available for each task, or you can go straight to the solution source code.

Task 1

Create a new applet called CompassPoints. Change it's layout from none (null) to BorderLayout.
First make sure you've selected the Visual Composition tab.

Select your applet's frame, then select the menu-item Tools->Properties. In the dialog that appears, click on layout then click the button to the right with the three "periods".

In the Prompter Window, select BorderLayout from the pull-down menu at the top. Then hit the Ok button and close the Properties window.

Task 2

Create and add a new button for each position: North, South, East, West, and Center.
First, make sure the Sticky check-box is selected.

From the Bean Palette select Buttons>Button. Now you can add your buttons in quick succession: click once on the top-most part of the applet's frame, then the left-most, right-most, bottom-most, and finally the center. Another way to get correct positioning is to hold the mouse button down and move it around until the dotted box appears in the area you want the button to occupy.

You can change the label of the buttons by holding the Alt key and clicking on them. Type the new text and press enter (or click the mouse somewhere else.) You can also change the label from the button's property sheet.

Task 3

Save your applet and test it by pressing the "Test Bean" button, which is the first button on the toolbar in the Visual Composition Editor.

Copyright © 1996-1997 MageLang Institute. All Rights Reserved.