gpt4 book ai didi

Java——错误找不到符号

转载 作者:行者123 更新时间:2023-12-01 18:33:03 24 4
gpt4 key购买 nike

我不明白为什么我在几个地方收到“错误找不到符号”。有人可以解释一下这个简单的问题吗?

  • PriceCalculator.java:18: 错误:找不到符号 --- private JTextFeildpriceFeild1;
  • PriceCalculator.java:19:错误:找不到符号 --- private JTextFeildpriceFeild2;
  • PriceCalculator.java:41:错误:找不到符号 --- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  • PriceCalculator.java:44:错误:找不到符号 --- 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();
    }

    }

最佳答案

这是因为你拼写错误(JTextFeild)。它应该是JTextField

此外,setDefaultCloseOperation 而不是 setDefaultCloseOperation

关于Java——错误找不到符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23286874/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com