Assertion: applet's button | /r/HasProperty | clicked
Facets:
Source sentences:
text: For example, if our program has a button in it and in order to listen a button click event, we must implementinterface and implement its method, which gives us the name of the button that was clicked, that lead to a button click event.
text: The applet notifies each button that it wishes to be a listener to the button, i.e., that it wishes to be notified when the button is clicked The applet sends a reference to itself ( this ) to the button's addActionListener method The applet is said to register itself as a listener with the button.
text: In particular, the method, getSource can be invoked to determine which button generated the event (i.e., which button was clicked).
text: getSource returns a reference to the interface component that generated the event Knowing which component (button) generated the event allows the listener to determine what should be done Using the getSource method to distinguish betwen the two buttons, the actionPerformed method simply prints a message stating which button was clicked.