我的程序哪里错了??在编译的时候会出现:
ceshi.java:28: 需要 <标识符>
Jmenuitem2.addActionListener(new ActionListener()
^
1 错误
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class JWindow extends JFrame
{
Qipan Q=new Qipan();
public JWindow(String str)
{
super(str);
add(Q);
}
public static void main(String[] args)
{
System.out.println("nihao");
JWindow jwindow=new JWindow("五子棋对战平台");
jwindow.setSize(400,350);
jwindow.setLocation(300,180);
jwindow.setVisible(true);
jwindow.setDefaultCloseOperation(jwindow.EXIT_ON_CLOSE);
}
class QiPan extends JPanel
{
JMenuBar Jmenubar=new JMenuBar();
JMenu Jmenu=new JMenu("操作");
JMenuItem Jmenuitem1=new JMenuItem("开始");
JMenuItem Jmenuitem2=new JMenuItem("退出");
Jmenuitem2.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}
});
}
}