题目是:创建一个Frame,实现窗口的监听器接口,我写了如下程序,但是出现了问题,,编译不出结果来,,我不知道是哪里出了,,请大家帮我看看。知道的给我说下。。谢谢了
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class JFrame1 extends JFrame implements ActionListener
{
public JFrame1()
{
super( "frame ");
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
public void actionPerformed(ActionEvent e)
{
JFrame1 jFrame = new JFrame1();
jFrame.setSize(200,200);
jFrame.setVisible(true);
}
public static void main(String[] args) {
new JFrame1();
}
}
------解决方案--------------------
public static void main(String[] args) {
JFrame1 jFrame = new JFrame1();
jFrame.setSize(200,200);
jFrame.setVisible(true);
}