怎么在简单窗体添加JButton控件的单击事件,新手虚心请教
JButton jb=new JButton("弹出另一个窗体");
jb.setBounds(10, 10, 100, 20);
jb.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
new MyJDialog(Projece.this).setVisible(true);
}
});
上面红字的那个new ActionListener有错误,不知道怎么添加一个JButton单击事件。
求大神解释