Java Reference
In-Depth Information
fixed —This component's size doesn't change when the parent container is
resized. When no other sizing policy is selected, the fixed policy is in effect.
10.4.7
Setting fill policies
Each component under layout control has a
property setting called fill that controls the
directions, if any, in which the component
should expand to fill its cell in the grid layout.
This is best illustrated by the example shown
in figure 10.9. This layout is a grid of four
cells, equally distributed, with a button in
each cell. A different fill mode has been spec-
ified for each button, as indicated by the but-
tons' names. A fill mode of none uses default
values, typically as small as permitted.
Figure 10.9 The fill property controls
the behavior of components when
they're added to the grid layout, defining
how they react to the grid cell they're
placed in.
10.4.8
Adding borders
You can add a decorative border to any JP anel or
other container, including the root container of
your interface. To do so, select the container and
edit its border property. You must expand the
property node, because there are two settings to
specify: The type and title properties are set sep-
arately, meaning you can combine them for best
effect. For example, you can combine an etched
border with a title to get an etched style, titled bor-
der, and so forth. Titled borders are a good way to
group related components together within a more
complicated dialog. You can see an example of
some of these combinations in figure 10.10.
Figure 10.10 The GUI Designer
uses simple properties to support
borders, a common visual
component to many complex GUI
designs.
10.5 Adding functionality to forms
A form that has been designed and laid out may be pleasing to the eye, but if it
isn't bound to an underlying Java class, it's useless. It has no business logic and no
functionality behind it. Buttons click without effect, combination boxes stand
empty, and so on. If the purpose of a GUI is to let the user interact with predefined
 
 
 
 
 
 
 
 
 
Search WWH ::




Custom Search