You have seen Buttons and ActionListeners; TextFields and ActionListeners; Component and java.awt.event.MouseListener .
Remember MVC? In Java, much of programming is event driven.
Thus the user has components (views) which are associated with particular actions (interfaces - which constitute the controllers) when events happen (eg., pushing the button).
Different components generate different events and expect different
interfaces to be implemented.
To implement an interface means to actually have code for
the methods defined in a given interface. The
API can be used to see which interfaces certain components expect to be implemented.
Follow some Listeners on the API to see the kinds of methods that
are expected to be implemented. Look at Lists, CheckBoxes, etc. Also note that the methods in different
Listener's have different event parameters.
Here is an example with a scrollbar:
Remember how each component needs the three statements in the init():
A bunch of examples using Scrollbar: (look at the applets and then the code to see how different values change)
Also, SWING might interest you
Remember the code that you were supposed to make Object Models for
in Lab 5: DrawTest and its applet and TicTacToe and its applet . Let's look and see if
we understand why certain methods are there now.
Remember that an Applet first calls init() then is painted.
Three major methods to remember for an Applet thus become
Remember to call repaint() in the Interface methods but not
in the paint method. Why?
For more on Components and Layout Managers, see this page and for Applications and
menus, you might find this page interesting.