Setting Up Buttons and Labels Like most GUIs, the SwingApplication GUI contains a button and a label. For example, in the Java look and feel, typing Alt-i results in a button click. The third line registers an event handler for the button click, as discussed later in this section. That code exists solely to hint to assistive technologies that the label describes the button. Now that you know how to set up buttons, you also know how to set up check boxes and radio buttons, as they all inherit from the AbstractButton class.
Check boxes are similar to radio buttons, but by convention their selection models are different.
On the other hand, only one button can be selected from a group of radio buttons. The following figures show screenshots of two programs that use check boxes and radio buttons. As you'd expect, the CheckBoxDemo application shows the use of check boxes, and the RadioButtonDemo application shows the use of radio buttons. Every time the user types a character or pushes a mouse button, an event occurs. Any object can be notified of the event.