*
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
Author

cannot find symbol

jonelo piad
Greenhorn

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: 14074
    
  16

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 7 API documentation
Scala Notes - My blog about Scala
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37962
    
  22
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.
Suggest
  • 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.
     
    Consider Paul's rocket mass heater.
     
    subject: cannot find symbol
     
    Similar Threads
    How to change components(JTextField) size dynamic in JTabbedPane?
    JSplitterView treats panes differently
    Not able to read the value of a component on one JPanel from a different JPanel
    Implementing scanner into a simple login page
    Swing Jpanel display problem