| 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
|
|
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
|
|
|
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
|
|
|
You're welcome.
|
 |
 |
|
|
subject: The method KeyPressed(KeyEvent) from the type new KeyAdapter(){} is never used locally
|
|
|