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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
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: 40034
    
  28
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: 40034
    
  28
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: 40034
    
  28
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