[单项选择题] Swing中要响应动作事件必须实现ActionListener接口,而实现ActionListenrer接口必须实现的方法是 ( )。
2021-07-14
[单项选择题] Swing中要响应动作事件必须实现ActionListener接口,而实现ActionListenrer接口必须实现的方法是 ( )。
A.actionPerformed()
B.focusGained()
C.actionMoved()
D.focusLost()
正确答案:A
参考解析:本题考查关于事件响应中Action Listener方法的基本知识。选项A正确, acfionPerformed()方法是ActionListener接口中的唯一方法;选项B错误,focusGained()方法是FocusListener接口中的方法;选项C错误, ActionListener接口中没有actionMoved();选项D错误,focusGained()方法是FocusListener接口中的方法。故本题答案是A。
词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。
