Kindly help me for the execution of the following codes
The following codes not compiling.
================================
import java.awt.*;
import java.awt.event.*;
public class Test2 implements ActionListener{
public static void main(String[]args){
Frame frame = new Frame("Hullo");
frame.setBounds(0,0,200,200);
FlowLayout flow = new FlowLayout();
frame.setLayout(flow);
TextField text1 = new TextField("This is .....");
TextField text2 = new TextField("Second one");
Button button = new Button("First");
frame.add(text1);
frame.add(text2);
frame.add(button);
frame.setVisible(true);
Test2 test = new Test2();
button.addActionListener(test);
}
public void actionPerformed(ActionEvent ee){
String msg = new String("Button pressed");
if(ee.getSource() == button){
text2=setText(msg);
}
}
}
=======================================
error:
D:\ceba_java\Test2.java:42: cannot resolve symbol
symbol : variable button
location: class Test2
if(ee.getSource() == button){
^
D:\ceba_java\Test2.java:43: cannot resolve symbol
symbol : variable text2
location: class Test2
text2=setText(msg);
^
D:\ceba_java\Test2.java:43: cannot resolve symbol
symbol : method setText (java.lang.String)
location: class Test2
text2=setText(msg);
^
3 errors
Tool completed with exit code 1