皮皮学,免费搜题
登录
搜题
【简答题】
下面是一个Applet程序,其功能是有2个按钮,分别为First和Second,以及一个Labe1构件。要求点击First时则能在 Labe1中显示出Command:First,而点击Second时则能显示出Command:Second,要求只能使用重载一次actionPerformed()方法。请改正程序中的错误(有下划线的语句),使程序能输出正确的结果。 注意:不改动程序的结构,不得增行或删行。 程序运行结果如下: import java.awt.*; import java.awt.event.*; import java.applet.*; /* <applet code=ex2_3.class width=800 height=400> </applet> */ public class ex2_3 extends Applet implements ActionListener { private String str='ok'; private Labe1 1; private Button btn; public void init() { setLayout(null); 1=new Label(str); 1.reshape(10, 10, 150, 30); add(1); btn = new Button('First'); btn.reshape(10, 50, 60, 20); 1.addActionListener(this); add(btn); btn = new Button('Second'); btn.reshape(10, 100, 60, 20); btn.setActionCommand('First'); btn.addActionListener(this); add(btn); } public void actionPerformed(ActionEvent ae) { str='Command: ' +ae.getActionCommand(); btn.setText(str); } } ex2_3.htm1 <HTML> <HEAD> <TITLE>ex2_3</TITLE> </HEAD> <BODY> <applet code='ex2_3.class' width=800 height=400 > </applet> </BODY> </HTML>
拍照语音搜题,微信中搜索"皮皮学"使用
参考答案:
参考解析:
知识点:
.
..
皮皮学刷刷变学霸
举一反三
【简答题】You are required to write a letter of promotion according to the following information given in Chinese. 以营销部经理Samuel Adams的身份写一封产品推销信。信件内容如下: 随信寄去数码相机的目录册。本公司产品的高质量众所周知,并广泛认可。相比较,价格为同行之最低。通过试用订购,贵方会认...
【简答题】三元锂电池的标称电压为( ) V 。
【单选题】我国治国安邦的总章程和当前建设中国特色社会主义的总钢领是()
A.
民法
B.
宪法
C.
法律
D.
行政法规
【单选题】三元锂电池的标称电压为( )V。
A.
1.2
B.
3.5
C.
3.7
D.
4
【单选题】It's high time ______ him a severe lecture for being late.
A.
you give
B.
you gave
C.
you'll give
D.
you should give
【单选题】三元锂电池的标称电压为
A.
2.0V
B.
1.2V
C.
3.7V
D.
5.2V
【简答题】阅读理解。 Different countries have different customs in giving presents. IN CHINA you must never give a clock to a Chinese person, because the sound of the word for 'clock' is similar to the sound for 'de...
【单选题】单体三元锂电池的标称电压为( ) V。
A.
3.2
B.
3.6
C.
1.2
D.
2
【单选题】我国治国安邦的总章程和当前建设中国特色社会主义的总纲领是
A.
民法
B.
宪法
C.
法律
D.
行政法规
【单选题】我国治国安邦的总章程和当前建设中国特色社会主义的总钢领是()
A.
民法
B.
法律
C.
宪法
D.
行政法规
相关题目: