问答题
import java.awt.*;
import java.awt.event.*;
public class ex7_2 extends Frame implements MouseMotionListener,ActionListener {
private Label l;
private String str="";
public static void main(String[] arg) {
new ex7_2();
}
ex7_2() {
;
setSize(200,200);
Button btn=new Button("exit");
btn.addActionListener(this);
add(btn,"North");
l=new Label(str);
add(l,"South");
show();
}
public void mouseMoved(MouseEvent event) {
str="Move: " + ;
l.setText(str);
}
public void mouseDragged(MouseEvent event) {
}
public void actionPerformed(ActionEvent event) {
if(event.getActionCommand().equals("exit")) {
System.exit(0);
}
}
}