问题
单项选择题
Swing中要响应动作事件必须实现ActionListener接口,而实现ActionListenrer接口必须实现的方法是 ( )。
A.actionPerfonned()
B.focusGained()
C.actionMoved()
D.focusLost()
答案
参考答案:A
解析: 本题考查关于事件响应中ActionListener方法的基本知识。选项A正确, actionPerformed()方法是ActionListener接口中的唯一方法;选项B错误,focusGained()方法是FocusListener接口中的方法:选项C错误, ActionListener接口中没有actionMoved();选项D错误,focusGained()方法是FocusListener接口中的方法。故本题答案是A。