File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes cannot find symbol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "cannot find symbol" Watch "cannot find symbol" New topic

cannot find symbol

jonelo piad

Joined: Oct 01, 2012
Posts: 5
What is the error here
i'm new to java so i don't know where

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15094

Jonelo: Please post the exact error message. "Cannot find symbol" means that you are using a variable name, or a class name or method name, that the compiler doesn't know. Maybe you are using a variable that has not been declared, or a method or class that doesn't exist. It could also be a spelling mistake in a name.

The error message from the compiler tells you exactly in which line of your source code the error happens and which name the compiler doesn't understand. Look carefully at the error message, go to that line in your source code and check what's wrong there.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46412
Welcome to the Ranch

I have added the code tags, and you can see how much better the code looks. I have also removed unnecessary blank lines. There is something not right about that design. You would usually have all the components as local methods in a constructor for the class, or an initGUI() method. That should set up all the components, layout, etc. I worry about seeing addActionListener(this), which often means people have got their hands on a resource which does not teach proper OO programming.
  • 1: Get the logic of your application working with a command‑line program. Don’t even think of creating a GUI until that works well.
  • 2: Create a class which connects to the application, passing calls to its different methods.
  • 3: Create a class which displays the GUI; it would have all the components as local variables in its initGUI method or constructor.
  • 4: Create listener classes for each kind of listener.
  • That is only a simplification of the process.

    I shall move this thread, because it would fit better into our GUIs forum.
    I agree. Here's the link:
    subject: cannot find symbol
    jQuery in Action, 3rd edition