package demoarray;
import java.awt.*;
import java.awt.event.*;
public class ActionEvent {
/**
* @param args
*/
public static void main (String[] args) {
// TODO Auto-generated method stub
Framedemo1 f = new Framedemo1("程序", 100, 100, 500, 500, Color.blue);
Button b = new Button("弹出");
b.setBounds(100,100,50,50);
Monitor m = new Monitor();
b.addActionListener(m);
f.setLayout(null);
f.add(b);
//f.pack();
f.setVisible(true);
}
}
class Monitor implements ActionListener{
public void actionPerformed(ActionEvent e){
new Framedemo1("me", 200, 200, 200, 200, Color.blue);
//System.out.println("aaa");
}
}
class Framedemo1 extends Frame {
Framedemo1(String s ,int x,int y,int w,int h,Color color){
super(s);
setBackground(color);
setBounds(x,y,w,h);
setVisible(true);
}
}
为什么连监听都监听不了~~我是看马士兵的教程做的~~~~高手帮忙瞅一眼 回答一下~~
------解决方案--------------------
改一下主类名,ActionEvent应该属于保留字之类的