[填空题] 请在下面代码中加入监听器语句。 import java.awt.*; import java.applet.Applet; public class Simple extends A

20 查阅

[填空题] 请在下面代码中加入监听器语句。

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)。

计算机考试