Adding a Button

You operate the ColorSwitch application by clicking a button.

To add a button:

  1. In the Swing pane of the Component Palette, click JButton.
  2. Click anywhere in the Form Designer.

    The button is displayed in the Form Designer, its corresponding node is displayed in the Component Inspector, and its source code is displayed in the Source Editor.

  3. In the Properties tab, select the default value for the text property and type Switch Color. Press Enter.
  4. In the Properties tab, click the value for the font property. Then click the ellipsis (...) button.
  5. In the Property Editor dialog box, select Bold for font style and 14 for font size. Click OK.

    The button label, Switch Color, should appear in larger bold type.

You should see Switch Color in half of the Form Designer pane. In the other half, you should see an empty space with a dark boundary line between the two components.

Next:  Setting Up the Button to Switch Color
Back:  Adding a Label and Setting Its Properties

Legal Notices