0

I don't understand why I get the "Error cannot find symbol" in several spots. Can somebody please shed some light on this simple problem.

  • PriceCalculator.java:18: error: cannot find symbol --- private JTextFeild priceFeild1;
  • PriceCalculator.java:19: error: cannot find symbol --- private JTextFeild priceFeild2;
  • PriceCalculator.java:41: error: cannot find symbol --- setDefaultCloseOpperation(JFrame.EXIT_ON_CLOSE);
  • PriceCalculator.java:44: error: cannot find symbol --- buildPanel();

    import javax.swing.*;
    public class PriceCalculator extends JFrame
    {
    private JPanel panel;                               // References the panel
    
    private JLabel messageLabel1;                       // References the whole sale label
    private JLabel messageLabel2;                       // References the markup label percentage
    
    private JTextFeild priceFeild1;                 // References the whole sale price
    private JTextFeild priceFeild2;                 // Referencts the markup label percentage
    
    private JButton calcButton;                     // References the calculator button
    
    private final int WINDOW_WIDTH = 550;           // References the window width
    private final int WINDOW_HEIGHT = 550;          // Referenecs the window height
    
    /** 
    
    Constructor below
    
    */
    
    public PriceCalculator()
    {
    // Set the window title
    setTitle("Retail Price Calculator");
    
    // Set the size of the window
    setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
    
    // Set the [x] exit button to close the program for the user
    setDefaultCloseOpperation(JFrame.EXIT_ON_CLOSE);
    
    // Build the panel and add it to the JFrame
    buildPanel();
    
    // Add the contents to the panels frame
    add(panel);
    
    // Display the window here
    setVisible(true);
    }
    
    
    
    
    /**
    
    Main Method Below
    
    */
    
    public static void main(String[] args)
    {
    new PriceCalculator();
    }
    
    }
    
user2981423
  • 45
  • 1
  • 7
  • 9
  • 2
    Raptor's answer is completely right; I just would recommend you to use IDE to prevent you from typos in classes/methods. – Dmitry Ginzburg Apr 25 '14 at 07:37
  • Duplicate of http://stackoverflow.com/questions/25706216/what-does-a-cannot-find-symbol-compilation-error-mean – Stephen C Mar 19 '17 at 07:20

2 Answers2

4

It is because you spell it wrong (JTextFeild). It should be JTextField.

Also, setDefaultCloseOperation instead of setDefaultCloseOpperation

Raptor
  • 53,206
  • 45
  • 230
  • 366
  • 2
    Also, get an IDE like Eclipse. Such a trivial mistake would be easily spotted by an intelligent code editor, which would also offer suggestions how to fix it (like offering similar, but correctly spelled known types and methods). You appear to be making it harder than necessary for yourself :) – hiergiltdiestfu Apr 25 '14 at 07:39
0

Your spelling mistake :

JTextFeild instead of JTextField

and setDefaultCloseOpperation(JFrame.EXIT_ON_CLOSE); instead of setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); you have used 2 p in Operation.

user3145373 ツ
  • 7,858
  • 6
  • 43
  • 62