Question 11: Given the following code:
import java.awt.*;
import java.awt.event.*;
public class MyApplet extends java.applet.Applet {
public void init() {
Button b = new Button("Button1");
b.addMouseListener(new ClickHandler());
add(b);
}
class ClickHandler extends MouseAdapter {
public void mouseClicked(MouseEvent evt) {
// A
}
}
}
What line of code at A writes the mouse’s horizontal location to the standard output at the time of the event?A 的部分应该填写什么呢?这是填空题。谢谢!
import java.awt.*;
import java.awt.event.*;
public class MyApplet extends java.applet.Applet {
public void init() {
Button b = new Button("Button1");
b.addMouseListener(new ClickHandler());
add(b);
}
class ClickHandler extends MouseAdapter {
public void mouseClicked(MouseEvent evt) {
// A
}
}
}
What line of code at A writes the mouse’s horizontal location to the standard output at the time of the event?A 的部分应该填写什么呢?这是填空题。谢谢!
当事件发生时 在标准输出中输出 鼠标的水平坐标值 吗?