Beginning of the BaldButton class

BaldButton is a local class that extends Button. (See Listing 3.)

Listing 3. Beginning of the BaldButton class.
    //Local class w/mouse events enabled. The new
    // class extends Button, and uses low-level
    // event handling to handle mouse clicked
    // events on the button.
    class BaldButton extends Button{
      BaldButton(String text){//constructor
        enableEvents(AWTEvent.MOUSE_EVENT_MASK);
        setLabel(text);
        //Display the name of the class file
        System.out.println("Local class name: " +
                           getClass().getName());
      }//end constructor
File: by.htm [Next] [Prev]