All Packages Class Hierarchy This Package Previous Next Index
Class cs005.event.ButtonListener
java.lang.Object
|
+----cs005.event.ButtonListener
- public abstract class ButtonListener
- extends Object
- implements ActionListener
Package cs005.event;
Class: ButtonListener
Last modified: 8/14/97 12:56am
This is the class used for making Buttons work! It implements the
java.awt.event.ActionListener interface, which has only one method,
actionPerformed. This method gets called every time the button that
the Listener is "listening to" is pressed. This method in turn calls
the buttonClick method, which is abstract and to be filled in in a
subclass.
How To Use: Subclass off of ButtonListener, filling in the abstract
method buttonClick with the code that you want to be executed when
the button is clicked.
Pass your ButtonListener into the Button's addActionListener()
method. For example:
myButton.addActionListener(myListener);
where myButton is
an instance of java.awt.Button and myListener is an instance of a subclass
of ButtonListener.
-
ButtonListener(Applet)
- Constructor: ButtonListener
This is the constructor used to create a ButtonListener.
-
actionPerformed(ActionEvent)
- Method: actionPerformed()
This is the method from the java.awt.event.ActionListener method.
-
buttonClick()
- Method: buttonClick()
This is the method that you should fill in in the subclasses.
ButtonListener
public ButtonListener(Applet app)
- Constructor: ButtonListener
This is the constructor used to create a ButtonListener. The ButtonListener
will be inactive until you pass it to a button using the button's
addActionListener()
method.
- Parameters:
- app - The Applet
actionPerformed
public void actionPerformed(ActionEvent e)
- Method: actionPerformed()
This is the method from the java.awt.event.ActionListener method. You
should not need to alter this method in any way in the subclasses. If
you do be sure to call super.actionPerfomed(e)
in order to
make sure that the buttonClick() method is actually called. You should
not need to call this method. Ever.
- Parameters:
- e - the ActionEvent that occurred.
buttonClick
public abstract void buttonClick()
- Method: buttonClick()
This is the method that you should fill in in the subclasses. This
method gets called every time the button that the Listener is "listening
to" is pressed. You do not need to call this method yourself. It
is called automatically for you. This is where you should put the code
that is to be executed every time the buttons are clicked.
All Packages Class Hierarchy This Package Previous Next Index