Check this code it should compile
import java.awt.*;
import java.awt.event.*;
public class Test2 implements ActionListener{
Frame frame = null;
FlowLayout flow = null;
TextField text1 = null;
TextField text2 = null;
Button button = null;
public Test2(){
frame = new Frame("Hullo");
frame.setBounds(0,0,200,200);
flow = new FlowLayout();
frame.setLayout(flow);
text1 = new TextField("This is .....");
text2 = new TextField("Second one");
button = new Button("First");
frame.add(text1);
frame.add(text2);
frame.add(button);
frame.setVisible(true);
button.addActionListener(this);
}
public static void main(String[]args){
Test2 test = new Test2();
}
public void actionPerformed(ActionEvent ee){
String msg = new String("Button pressed");
if(ee.getSource() == button){
text2.setText(msg);
}
}
}