ClickEvent Error in AppInventor-Sources

Hello everybody,
I was working on app inventor sources and i have triggered this error,
actually i was adding option to rename source structure item using a button added to a box, i had made my own code, but while compiling i got silly error which is Cannot find symbol : ClickEvent in this code

deleteButton.addClickHandler(new ClickHandler() {
      @Override
         public void onClick(ClickEvent event){
        sourceStructureExplorer.deleteItemFromTree();
      }
    });

This is the full log

$ ant noplay
Buildfile: D:\appinventor-sources\appinventor\build.xml

noplay:

init:

MakeWarLibsDir:

common_CommonUtils:

init:

CommonUtils:

common_CommonVersion:

init:

CommonVersion:

components_CommonConstants:

init:

CommonConstants:

WarLibs:

AiSharedLib:

AiServerLib:

components_AndroidRuntime:

common_CommonVersion:

init:

CommonVersion:

init:

HtmlEntities:

Barcode:

CopyComponentLibraries:

common_CommonUtils:

init:

CommonUtils:

CommonConstants:

AnnotationProcessors:

AndroidRuntime.uptodate:

AndroidRuntime:

AiClientLib:
   [depend] Deleted 105 out of date files in 1 seconds
    [javac] Compiling 203 source files to D:\appinventor-sources\appinventor\appengine\build\war\WEB-INF\classes
    [javac] D:\appinventor-sources\appinventor\appengine\src\com\google\appinventor\client\boxes\SourceStructureBox.java:69: error: cannot find symbol
    [javac]          public void onClick(ClickEvent event) {
    [javac]                              ^
    [javac]   symbol: class ClickEvent
    [javac] D:\appinventor-sources\appinventor\appengine\src\com\google\appinventor\client\boxes\SourceStructureBox.java:87: error: cannot find symbol
    [javac]          public void onClick(ClickEvent event){
    [javac]                              ^
    [javac]   symbol: class ClickEvent
    [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] 2 errors

BUILD FAILED
D:\appinventor-sources\appinventor\build.xml:50: The following error occurred while executing this line:
D:\appinventor-sources\appinventor\appengine\build.xml:545: The following error occurred while executing this line:
D:\appinventor-sources\appinventor\build-common.xml:125: Compile failed; see the compiler error output for details.

Total time: 19 seconds

I don't know the reason,
Help will be appreciated
Thank You

You haven't imported this class.

Where are you writing your code?
Recommend to use IDE like Eclipse, which can import the necessary package automatically, and have code prompt function.

I am using VS code and i do also have Intellij, and i know that this can be the case of importing, but i have seen this file too where this event is there and there's no import for this,

P.S. I found it just now,
Actually there is one more java file which has Click Handler and i have viewed it's all the imports and slipped this one to see specially and i thought that there will be no need for import

Anyways Thanks to both of you

In Java, each file is its own compilation unit. Classes can see other classes within their package without imports, but otherwise you need to import a class in every file you plan to use it.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.