Gaurav
Gaurav

Reputation: 11

How to solve error about implementing inherited abstract class method?

code-

new ItemListener() {
  public void ItemStateChanged(ItemEvent event){
    if(event.getStateChange()==ItemEvent.SELECTED)
      pics.setIcon(pic[box.getSelectedIndex()]);
  }
}

I am getting the error,

The new type ItemListener(){} must implement the inherited abstract class method ItemListener.ItemStateChanged(ItemEvent)

Upvotes: 0

Views: 502

Answers (1)

Mureinik
Mureinik

Reputation: 311188

Assuming this is an anonymous implementation of java.awt.event.ItemListener, it should implement the method itemStateChanged(ItemEvent e) - note the lowercase i in the API specification as opposed to the upper case I in your implementation.

Upvotes: 3

Related Questions