问题 填空题

请在下面代码中加入监听器语句。
importjava.awt.*;
importjava.applet.Applet;
publicclassSimpleextendsAppleimplementsMouseListener

StringBuffer;
publicvoidinit()

//监听器语句
buffer=newStringBuffer();
addltem(“initializing…”);

publicvoidmoseEntered(MouseEventevent)

publicvoidmoseExited(MouseEventevent)

publicvoidmosePressed(MouseEventevent)

publicvoidmoseReleased(MouseEventevent)

publicvoidmoseClicked(MouseEventevent)

addltem(“click!…”);

答案

参考答案:addMouseListener(tlfis);

解析: Java语占中注册监听器的方法为addMouseListener(this)。

选择题
问答题 简答题