ActionListener是一个接口,但为什么我可以创建实例对象?
JButton button = new JButton("Button1");
ActionListener me = new ActionListener(){
public void actionPerformed(ActionEvent ae){
JOptionPane.showMessageDialog(null,ae.getActionCommand());
}
};
button.addActionListener(me);
Run Code Online (Sandbox Code Playgroud)
还有什么?我不确定.请帮我.
归档时间: |
|
查看次数: |
2820 次 |
最近记录: |