i am new to
java so i have lots of doubts coming up while i am reading and coding some basic programs in java .
my doubt is in the following code
[code=java]
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
public class
Testing {
static JTextArea ta;
static JButton b1;
static JButton b2;
static JButton b3;
public static void main(
String []args)
{
JFrame f = new JFrame ("sample form");
ta= new JTextArea(20, 20);
b1 = new JButton("click here");
b2= new JButton("SUBMIT");
f.setLayout(new FlowLayout());
f.add(ta);
f.add(b1);
f.add(b2);
b1.addActionListener(new BHandler());
b2.addActionListener(new BHandler());
b1.setActionCommand("b1");
f.pack();
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
class BHandler implements ActionListener
{ int count;
public void ActionPerformed(ActionEvent e){
count++;
if(e.getActionCommand().equalsIgnoreCase("b1"))
{
ta.setText("BHandler"+ count +""+ e.getActionCommand());
} else
JOptionPane.showMessageDialog(null, e);
}
}
and in this error comes that ta symbol is not found in class BHandler .
please some one do reply what is wrong in the code