Search code examples
javajtablenetbeans-7listselectionlistener

Netbeans told that "declared variable" is a package that does not exist


enter image description here

It happened when I tried to use a ListSelectionModel.

Did I made some mistake?


Solution

  • You typed the statement at the wrong spot:

    class X {
    
        HERE - WHERE THE FIELD DECLARATIONS GO
    
        X() {
            STATEMENT SHOULD GO HERE
        }
    

    The compiler thinks to deal with a declaration, starting with a class, which may be x.y.z.C.