aspose file tools
The moose likes Beginning Java and the fly likes The method KeyPressed(KeyEvent) from the type new KeyAdapter(){} is never used locally Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "The method KeyPressed(KeyEvent) from the type new KeyAdapter(){} is never used locally" Watch "The method KeyPressed(KeyEvent) from the type new KeyAdapter(){} is never used locally" New topic
Author

The method KeyPressed(KeyEvent) from the type new KeyAdapter(){} is never used locally

Nicol Green
Ranch Hand

Joined: Jan 30, 2010
Posts: 66
I have following code and for KeyPressed it shows me error: "The method KeyPressed(KeyEvent) from the type new KeyAdapter(){} is never used locally". I want to validate input in JFormattedTextField.



Why it cannot be read ?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32833
    
    4
Please check the spelling carefully; you don't usually start method names with capital letters. Put the @Override annotation before the heading of that method and see whether you are getting any compiler errors.
The problem with Adapter classes is that it is possible to miss such tiny errors, which mean the method you think is being called is never called. The @Override annotation should always be used to catch that problem.
Nicol Green
Ranch Hand

Joined: Jan 30, 2010
Posts: 66
hmm, what a shame..

Sorry, I really didn't noticed, it happens when you looking the same code over and over again..
Thanks!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32833
    
    4
Lots and lots of people do that. That is nothing to worry about. Remember the @Override annotation.
Nicol Green
Ranch Hand

Joined: Jan 30, 2010
Posts: 66
Thanks!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32833
    
    4
You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The method KeyPressed(KeyEvent) from the type new KeyAdapter(){} is never used locally
 
Similar Threads
What is wrong with this code?
doClick and trapping of enter key
KeyAdapter Problem, With Source Code
key listener not detected
key update