Coding the toggle button is relatively easy, if not somewhat tedious. It is easy because you need only to enable or disable the interface. It is tedious because each widget that the user could interact with must be enabled or disabled separately. The
ToggleButton's functionality requires the creation of three methods. One method will initialize the button to respond to the user. A second method will enable all the data entry widgets, and the third will disable all the widgets. First enter the code in Listing 4.9 after the navigation bar button code to initialize the
ToggleButton. Remember to import any items underlined in red.
private void initToggleButton() ...