Adding a Label and Setting Its Properties

This step shows you how to select a component and set its properties. It also demonstrates how a visible component is displayed after being added in the Form Designer.

Your application uses a blank label with an opaque background to display the colors. You need to add the label and set its properties.

To add a label:

  1. Click the Swing tab on the Component Palette.
  2. In the Swing pane, click the JLabel button.
  3. Click anywhere in the Form Designer.

    A label with the text jLabel1 is displayed in the Form Designer. In the Component Inspector, a node named jLabel1 [JLabel] is displayed and highlighted in the tree view. The properties for the component are displayed in the Properties pane. Source code for the label is displayed in the Source Editor.

  4. In the Properties tab, scroll to the text property and delete jLabel1, leaving the value blank. Press Enter.
  5. In the Other Properties tab, scroll to the opaque property and select its default value, False. Select True from the combo box.

All you should see in the Form Designer is a line that demarks the boundary of the jLabel1 component.

Next:  Adding a Button
Back:  Selecting a Layout Manager
See also
Working With Components
Component Palette
Component Inspector
Form Designer

Legal Notices