Placing and Aligning a Component in a Form


To design forms with Matisse, you drag components from the Palette into your form. As you drag the component close to other components or the container edges, the component automatically snaps to align with other components.

To add a component to a form:

  1. Click a component in the Palette to select it.

  2. Move the cursor to the location in the form where you want to place the component. The IDE suggests alignment and anchoring as you near other components.

  3. Click to place the component. If you want to enter multiple components, hold down the Shift key and click multiple times.

For instance, in Figure 6-2, the first JLabel is anchored to the top and left edges of the JFrame, with the default spacing defined by the look and feel.

Figure 6-2. JLabel snapped to the top-right corner of a JFrame


In Figure 6-3, JLabel2 is snapped to the baseline of the Options JLabel.

Figure 6-3. JLabel snapped to the baseline of another JLabel


When you've placed the components, you can select any component to see what it is anchored to, as shown in Figure 6-4. The graphic shows the component or container edge to which a component is anchored.

Figure 6-4. Guidelines showing the anchoring relationships of the two JLabel components


You can edit the display text of any JLabel, JTextField, or JButton by double-clicking it in the Design view.




NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net