Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Keylistener help!

Posted on 2003-10-22
6
250 Views
Last Modified: 2008-02-01
hi,
I am tring to add a key listener to my java 3D class by using this code

[code] public class SpinnerGame extends Applet implements KeyListener{  [/code]

But when i try to compile it says

[b] SpinnerGame is not abstract and does not override abstract method keyTyped(java.awt.event.KeyEvent) in java.awt.event.KeyListener [/b]

what does this mean??? it is so fustrating please can someone help
0
Comment
Question by:jamesloi
6 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 32 total points
ID: 9601036
SpinnerGame has to implement these three public methods:

void keyPressed(KeyEvent e)
          Invoked when a key has been pressed.
 void keyReleased(KeyEvent e)
          Invoked when a key has been released.
 void keyTyped(KeyEvent e)
          Invoked when a key has been typed.
0
 
LVL 15

Assisted Solution

by:jimmack
jimmack earned 31 total points
ID: 9601169
Or you could create an inner class that extends KeyAdapter.

KeyAdapter is a convenience class that has "default" implementations of the key... methods.
0
 

Assisted Solution

by:zechariahs
zechariahs earned 31 total points
ID: 9621348
CEHJ is right, but I just want to give you some more detail.

keyPressed is invoked when a key is pressed down.
keyReleased is invoked when a pressed key is let up.
keyTyped is invoked after a key has been pressed and released.

Only reason I went into more detail is because I've seen a lot of people rack their brains over the differences.
0
 
LVL 3

Assisted Solution

by:InNoCenT_Ch1ld
InNoCenT_Ch1ld earned 31 total points
ID: 9720504
0
 
LVL 92

Expert Comment

by:objects
ID: 10194174
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split between CEHJ, jimmack, zechariahs and InNoCenT_Ch1ld

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

objects
EE Cleanup Volunteer
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question