import java.awt.*;
import java.awt.event.*;public class kl implements ActionListener{
public Button b1;
public Frame f;
public static void main(String[]a){
kl x = new kl();
x.b1=new Button("first");
x.f=new Frame("hello");
x.f.add(x.b1);
x.f.setSize(100,100);
x.b1.addActionListener(x);
x.f.show();
} public void actionPerformed(ActionEvent e){
if (e.getSource() instanceof Button){
((Button)e.getSource()).setLabel("seconed");
}
}
}
import java.awt.event.*;public class kl implements ActionListener{
public Button b1;
public Frame f;
public static void main(String[]a){
kl x = new kl();
x.b1=new Button("first");
x.f=new Frame("hello");
x.f.add(x.b1);
x.f.setSize(100,100);
x.b1.addActionListener(x);
x.f.show();
} public void actionPerformed(ActionEvent e){
if (e.getSource() instanceof Button){
((Button)e.getSource()).setLabel("seconed");
}
}
}
Button b1;
Frame f;
public static void main(String[]a){
b1=new Button("first");
f=new Frame("hello");
f.add(b1);
f.show();
}
public boolean action(Event e,Object o){
if(e.target instanceof Button){
if(<b>o=="first"</b>){
b1.setLabel("second");
}
}
}
}
黑体部分不太对
o=="first"这句肯定有问题。