菜鸟做个黑桃王,问题不断啊求助
用的是Eclipse Juno JRE是1.7
CardJFrame extends JFrame 是主程序类
public class userop implements ActionListener{
public userop(JPanel useropPanel,CardJFrame supframe,int usern)
{
JButton bidpp=new JButton("+");
bidpp.setBounds(150,10,45,30);
useropPanel.add(bidpp);
bidpp.addActionListener(supframe);//这里报错
.....
}
public void actionPerformed(ActionEvent evt) {
// TODO Auto-generated method stub
Object src = evt.getSource();
if (src == bidpp) {
}
}
是这样写的吧?
我看到有人是
bidpp.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
我不喜欢在一个参数里写一个函数,这个太头重脚轻了
[解决办法]