Java Reference
In-Depth Information
Figure 10.4 After you apply a grid layout,
the components fall into cells (or sets of
cells) that keep them aligned and
constrained.
Figure 10.3 The components are laid
out in the Form Workspace at a near
approximation of where they should
appear in the GUI.
for the currency lists, JB uttons for the Convert and Quit operations, and JL abels
to explain the various components. In figure 10.3, the components are roughly in
the desired arrangement.
10.3.3
Applying the grid layout
Click the grid layout button to automatically enclose the components in a JP anel,
as shown in figure 10.4. As you can see, the items are placed into a grid layout
with spacing appropriate to the original layout. The Result field spans three col-
umns; the labels and input fields are aligned; and the action buttons are on the
bottom, offset one column to the right (thanks to a horizontal spacer).
10.3.4
Setting component properties
Select the Amount to be converted text field, either by clicking it in the Form
Workspace or by choosing its entry on the component tree view. Blue resize han-
dles indicate that you've selected the correct field. Because this field only makes
sense if you enter a number, let's set a default. Find the text entry in the Proper-
ties Inspector, and enter 100.00 in the value field. The Form Workspace changes
to reflect the default value.
Also select the Results text field, and prevent users from typing anything in
that field by setting its enabled property to false . That field is strictly for feed-
back from the software; there's no need for users to enter any data.
10.3.5
Touching up the final interface
Now that you have a clean, flexible layout, you're free to touch it up as needed. In
this case, we added a margin of 11 pixels around the JP anel to give the interface a
 
 
 
 
 
Search WWH ::




Custom Search