首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

生手求指教,关于ActiontionListener

2013-03-19 
新手求指教,关于ActiontionListener[解决办法]this是指代码被执行时的本类当前对象(ButtonDemo)[解决办法]

新手求指教,关于ActiontionListener
生手求指教,关于ActiontionListener
[解决办法]
this是指代码被执行时的本类当前对象(ButtonDemo)
[解决办法]
this是指代码被执行时的本类当前对象(ButtonDemo)
[解决办法]
建议在用addActionListener()方法时用内名内部类的方法实现actionPerformed()方法

jbtStart.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
thread.start();
jbtStart.setEnabled(false);
}
});

[解决办法]
哦明白你意思了 参数类型ActionListener是一个接口类型,但是实参this的类ButtonDemo也是实现了ActionListener这个接口的,因此它就是这种接口类型 
[解决办法]
The method ActionListener(ActionListener)in the type AbstractButton is not applicable for the arguements(ButtonDemo)不明白说的是什么意思 

根据你的报错,我怀疑ButtonDemo类实现的ActionListener接口不是java.awt.event.ActionListener,而是一个自定义的重名类

根据两点推测
ActionPerformed方法实现了接口中方法
ButtonDemo有黄色警告

热点排行