![]() ![]() ![]() |
|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Training Index
Counting Key Pressesby
Exercise
API Docs
About This Short Course
Short Course
Exercises
Help is available for each task.
Task 1To receive the key events, add the applet itself as an To the class definition, add: implements KeyListener In the addKeyListener(this);This means that the current object is functioning as the listener, that is, the target, for all key events distributed by the source, in this case, the applet itself. Thus, this object, that is, the applet, must define the method(s) specified in the KeyListener interface.
Task 2Define the public void keyPressed(KeyEvent e) { increaseCount(); repaint(); } Do not call By the way, the difference between the methods is that
Copyright 1996-2000 jGuru.com. All Rights Reserved. |