本人是一名在校大学生,学校机房用的是MyEcilpes8.6,自己用学生证申请了一年idea,这段代码在机房可以运行,但是在idea上无法运行,跪求各位大神指点啊!运行之后显示:
错误: 在类 test 中找不到 main 方法, 请将 main 方法定义为:
public static void main(String[] args)
否则 JavaFX 应用程序类必须扩展javafx.application.Application
进程已结束,退出代码为 1
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class test extends Applet{
Frame f1=new Frame();
Button b1=new Button("显示");
Button b2=new Button("隐藏 ");
public void init(){
this.add(b1);
this.add(b2);
f1.setTitle("My first Frame");
f1.setSize(200,400);
f1.addWindowListener(new FrL());
b1.addActionListener(new BuL());
b2.addActionListener(new BuL());
}
class BuL implements ActionListener{
public void actionPerformed(ActionEvent e) {
if(e.getSource()==b1)
f1.setVisible(true);
else
if (e.getSource()==b2)
f1.setVisible(false);
}
}
class FrL extends WindowAdapter{
public void windowClosing(WindowEvent e){
f1.setVisible(false);
}
}
}