# Adding Labels

You can add a label into your layout in the following forms:

- Text Label. Creates a plain text label (a simple string of text)
- Multi-line label. Creates a label displaying more than one line of text
- Labeled bar. Creates a labeled bar (horizontal rule with a text string)

To add a single-line label:

1. Click on the Text Label component in the AWT palette tab.
2. Click in the cell where you want to place the component.
3. Open the attribute editor by clicking on its button in the main toolbar.
4. Type a unique component ID in the name box.
5. Type the label name in the text box.

### Special Attributes

`alignment` | Aligns text to the left, right, or center of the bar.

To add a multiline label:

1. Click on the Multi-line Label component in the Additional palette tab.
2. Click in the cell where you want to place the component.
3. Open the attribute editor by clicking on its button in the main toolbar.
4. Type a unique component ID in the name box.
5. Make sure the `maxColumns` attribute has a value of -1.
6. Click on the button to the right of the text box.
7. In the dialog box, type text for the label. Each line of text in the dialog box appears as a row in the label. You cannot wrap a line of text.

### Special Attributes

`alignment` | Aligns text to the left, right, or center of the bar.
`maxColumns` | A value of 1 disables the multicolumn feature; multiple lines of text will be formatted in a single column. A value of -1 enables the multicolumn feature.

To add a labeled bar:

1. Click on the Labeled Bar component in the Additional palette tab.
2. Click in the cell where you want to place the component.
3. Open the attribute editor by clicking on its button in the main toolbar.
4. Type a unique component ID in the name box.
5. Type the label name in the text box.
6. (Optional)Select left, center, or right from the alignment list to set the position of the text on the rule.

### Special Attributes

`alignment` | Aligns text to the left, right, or center of the bar.
`textOffsetFromEdge` | Number of pixels the text is offset from the edge of the cell.

See also:

  Laying Out the Interface
  Generating Java Source Code
  Adding Operations to Components
  GUI Builder Palette

  Visual Java GUI Builder API Documentation
    Visual Java GUI Builder Runtime Packages
    Class Hierarchy
    Index of All Fields and Methods