• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cannot find symbol

 
jonelo piad
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the error here
i'm new to java so i don't know where

 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15441
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49793
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic