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. Select the default value for the text property, type Switch Color, and press Enter.

  4. Click the value for the font property, and then click the ellipsis (...) button.

  5. In the Property Editor dialog box, select Bold for font style and 12 for font size, and click OK.

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

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

Legal Notices