题目内容

监视器listen为了监视JFrame窗口触发的WindowEvent事件,下列说法确的是()

A. 创建监视器listen的类需要实现ActionListener接口。
B. 创建监视器listen的类需要实现ItemListener接口。
C. 创建监视器listen的类需要实现DocumentListener接口
D. 创建监视器listen的类可以是WindowAdapater类的子类

查看答案
更多问题

监视器listen为了监视JCheckBox复选框触发的ItemEvent事件,下列方法正确的是()

A. 创建监视器listen的类需要实现ActionListener接口
B. 创建监视器listen的类需要实现ItemListener接口
C. 创建监视器listen的类需要实现DocumentListener接口
D. 创建监视器listen的类可以是MouseAdapater类的子类

下列叙述错误的是()

A. JCheckBox选择框提供两种状态,一种是选中,另一种是未选中
B. JTextArea上不能触发MouseEvent事件
CheckBox选择框可以触发IteraEvent事件
D. JTextArea文本区的Document对象可以触发DocumentEvent事件

对于下列代码,叙述正确的是()import java.awt.*;import javax.swing.*;import java.awt.event.*;public class Win extends JFrame {JButton b;public Win() {setLayout(new FlowLayout());b = new JButton("yes");add(b);b.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) {b.setText("ok");}});setVisible(true);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);}public static void main(String args[]){new Win();}}

A. 窗口Win的布局是BorderLayout布局
B. 用户单击按钮b不会触发ActionEvent事件
C. 用户单击按钮b后,按钮上的名字改变成ok
D. 用户单击按钮b后,按钮上的名字仍然是yes

挑错题:A、B、C、D注释标注的哪行代码有错误?import javax.swing.*;import java.awt.*;public class Win extends JFrame {JTextField text;public Win() {setLayout(new FlowLayout()); //AsetLocation(500,400); //Btext = new TextField(8); //Cadd(text);setVisible(true);setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //D}}

A
B
C
D

答案查题题库