苏。据说java找不到符号..
我已经在Interface.java上包含了类接口,但不知何故它说找不到符号
这些是Interface.java的代码
package com.gui;
import javax.swing.*;
import java.awt.*;
public class Interface {
public Interface() {
JFrame frame = new JFrame();
JButton button = new JButton("click to close");
JLabel label = new JLabel("click that button to exit");
JPanel panel = new JPanel();
panel.setBorder(BorderFactory.createEmptyBorder(300, 300, 100, 300));
panel.setLayout(new GridLayout(0, 1));
panel.add(button);
panel.add(label);
frame.add(panel, BorderLayout.CENTER);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("gui test");
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
}
}这些是来自Main.java的代码
package com.gui;
public class Main {
public static void main(String[] args){
new Interface();
}
}发布于 2021-05-23 23:29:22
我已经下载了用Intellij打开的项目,得到了和你一样的错误。
我设法通过将Interface类更改为Interface1 (在Interface上使用SHIFT + F6 )来修复它。

我把压缩包上传到这里:
https://drive.google.com/file/d/1Y_-7juqPtJKdUeWdLhRCvWMFLHYagVwQ/view?usp=sharing (我希望你确实可以访问它)
https://stackoverflow.com/questions/67658035
复制相似问题