How do I "make clickable"?

In ProjetList.java I have made a HorizontalPanel and I want to make it clickable but I am getting errror
My code

  bottomPanel = new HorizontalPanel();
  bottomPanel.setStyleName("ode-BottomPanel");
  bottomPanel.add(download);
  bottomPanel.add(delete);
  bottomPanel.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      Ode ode = Ode.getInstance();
      // If the screens are locked, don't take this action. Also
      // do not open the project if it is in the trash!
      if (ode.screensLocked() || project.isInTrash()) {
        return;
      }
      ode.openYoungAndroidProjectInDesigner(project);
    }
  });

Error

AiClientLib:
[depend] Deleted 338 out of date files in 2 seconds
[javac] Compiling 146 source files to C:\Users\Mr. Afroz\Desktop\appinventor-sources\appinventor\appengine\build\war\WEB-INF\classes
[javac] C:\Users\Mr. Afroz\Desktop\appinventor-sources\appinventor\appengine\src\com\google\appinventor\client\explorer\youngandroid\ProjectList.java:324: error: cannot find symbol
[javac] bottomPanel.addClickHandler(new ClickHandler() {
[javac] ^
[javac] symbol: method addClickHandler()
[javac] location: variable bottomPanel of type HorizontalPanel
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 error

BUILD FAILED
C:\Users\Mr. Afroz\Desktop\appinventor-sources\appinventor\build.xml:16: The following error occurred while executing this line:
C:\Users\Mr. Afroz\Desktop\appinventor-sources\appinventor\appengine\build.xml:545: The following error occurred while executing this line:
C:\Users\Mr. Afroz\Desktop\appinventor-sources\appinventor\build-common.xml:125: Compile failed; see the compiler error output for details.

Total time: 12 seconds

1 Like

I've read a webpage about HorizontalPanel.

Conclusion :

There is no method named addClickHandler(ClickHandler) in it.

I think you can use this method :

public final <H extends EventHandler> HandlerRegistration addHandler(H handler, GwtEvent.Type<H> type)

https://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/Widget.html#addHandler-H-com.google.gwt.event.shared.GwtEvent.Type-

2 Likes