It does nothing (as is the case with our HelloWorld applet), unless we specify it (as is the case with our Addition
applet).
The action method enables the person who uses the applet to interact with the applet via the GUI components (e.g.,
buttons, and text fields).
Such an interaction is called an event.
Later, we more fully discuss the GUI components, and the event-driven model on which they are based.
When the user of the Addition applet types into the text field, and presses enter or return, the action method is
executed with this event as one of its arguments.
public boolean action(Event e, Object o)
{
...
}
indicates that the method is:
public (explained later)
returns a boolean value (i.e., either true or false),
receives 2 arguments:
an Event named e
an Object named o
The event argument, e, is used by the applet to determine what event occurred.
In some applets (not our Addition applet), many events can occur.
In the Addition applet, the only event that can occur is when the user presses enter or return, while the cursor is in the
TextField.