Adding a Button

You operate the ColorSwitch application by clicking a button.

To add a button:

  1. In the Swing pane, click JButton.
  2. Click anywhere in the Form Editor.

    The button is displayed in the Form Editor, 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, then press Enter.
  4. In the Properties tab, click the value for the font property, and then click the ellipsis (...) button.
  5. In the Property Editor dialog box, select Plain for font style and 14 for font size, and click OK.

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

You should see Switch Color in half of the Form editor and an empty space in the other half with a dark boundary line between the two components.

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

Legal Notices