按钮事件
import java.awt.*;import java.awt.event.*;
public class TestButton{
public static void main(String args[])
{
Frame f = new Frame("Test");
Button b = new Button("Press me");
b.addActionListener(new ButtonHandle());
f.setLayout(new FlowLayout());
f.add(b);
f.setSize(200,200);
f.setVisible(true);
}
class ButtonHandle implements ActionListener{
public void actionPerformed(ActionEvent e){
System.out.println("Action occurred");
}
}
}
照例子写的代码,就是编译通不过,求助!