首页题目详情

在Java Swing中,若要使一个JButton触发ActionListener的actionPerformed()方法,必须进行哪种操作?

题目配图
A.设置JButton的名称
B.添加ActionListener到JButton上
C.设置JButton的背景颜色
D.设置JButton的字体大小

优质解答

答案

B

解析

要让JButton触发ActionListener的事件处理方法,需要将监听器实例添加到该按钮上。

查看答案和解析

支付 ¥0.1 即可查看此题答案和详细解析

低至 ¥0.1 起

面向对象程序设计单选题中等AI生成