All details of what is wrong with your code are in the error message, you just need to carefully read it. Look,
word
anonymous
and sign$
inMidlet$2
tell you something is wrong in the anonymous class.
In your code snippet, there's only one such class:new com.sun.lwuit.events.FocusListener
does not override abstract method focusLost(com.sun.lwuit.Component)
means your anonymous class misses a definition of a method with such a signature (signature is method name and type of parameters)Look closer in the methods you defined in that anonymous class, is there a method compiler is complaining about?
At the first glance, you may think it's there, there's a method called
focusLost
- but (!) you need to remember that signature is not only method name, but also parameters type - and (!) if you look closer, you'll find out that parameter type is not that is said to be required in error message.
Your anonymous class has method focusLost(com.sun.lwuit.Label)
but error message says there should be method with different signature (different parameter type) - focusLost(com.sun.lwuit.Component)
.
To fix this compilation error, add to the anonymous class new com.sun.lwuit.events.FocusListener
a method with required signature: focusLost(com.sun.lwuit.Component)
.