addClickHandler problem

hi all,

when i copied the showcase code for menuitem to my own project.

an error “The method addClickHandler(ClickHandler) in the type MenuItem is not applicable for the arguments (new ClickHandler(){})” pop up.

i don’t understand why this error appear and how to resolve. it extracted the exact same code from showcase. can someone help me?

the code i used is :

   MenuItem closeItem = new MenuItem("<u>C</u>lose");
      closeItem.setEnableIfCondition(enableCondition);
      closeItem.setKeyTitle("Alt+C");
      KeyIdentifier closeKey = new KeyIdentifier();
      closeKey.setAltKey(true);
      closeKey.setKeyName("C");
      closeItem.setKeys(closeKey);
      closeItem.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
        	  
          }

      });

it is the addClickHandler that is giving the error.

Are you using an IDE for development? Were you able to compile the code? It appears you might be importing the ClickHandler from the wrong package. Make sure it is

“com.smartgwt.client.widgets.menu.events.ClickHandler”

Sanjiv