Positioning Components in Cells
You can reposition components in the layout in the following ways:
- Anchor the component to a particular
location in the cell
- Inset the component by a specific pixel
amount from the edges of the cell
- Align the text in a label with the left
edge, right edge, or center of the label
To anchor a component in a cell:
- Select a component in a cell.
- Open the attribute editor by clicking on its button in the toolbar.
- Click on the anchor button and choose an anchor position.
To set the cell margins:
- Select a component in a cell.
- Open the attribute editor by clicking on its button in the toolbar.
- In the insets box, enter the number of pixels that you want
between the component and the top, bottom, left, and right edges of the
cell. For example, if you want to move a label to the left and up, you
could specify
left=15;top=8;
To set the cell margins with the insets dialog box:
- In the attribute editor, click the button to the right of the
insets box.
- Enter the desired number of pixels in the boxes.
To position text in a label:
- Select a component in the grid that contains a label.
- Open the attribute editor by clicking on its button in the toolbar.
- Click on the alignment list and choose left, center, or right.
You can change the position of text only in a label. Other text,
such as button names, checkbox names, and text in text fields, cannot be
repositioned.
To resize a cell in the grid or a component in a cell, see Resizing a Component. To set the resize
behavior of a component to resize with the window that contains it,
see Resizing the Layout.
See also:
- Laying Out the Interface
- GUI Builder Palette
- Generating Java Source Code
- Visual Java GUI Builder API Documentation
- Visual Java GUI
Builder Runtime Packages
- Class Hierarchy
- Index of
All Fields and Methods