问题
填空题
请在下面代码中加入监听器语句。
import java.awt.*;
import java.applet.Applet;
public class Simple extends Apple implements MouseListener
StringBuffer;
public void init()
//监听器语句
buffer=new StringBuffer();
addItem("initializing…");
public void moseEntered(MouseEvent event)
public void moseExited(MouseEvent event)
public void mosePressed(MouseEvent event)
public void moseReleased(MouseEvent event)
public void moseClicked(MouseEvent event)
addltem("click!…");
答案
参考答案:addMouseListener(this)
解析: Java语言中注册监听器的方法为addMouseListenet(this)。