Getting
"Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException"
at soms1.actionPerformed over all ActionListener events of lines:  
 thread.set_state(1);
 thread.set_state(2);
 thread.reset;
 thread.send;
Can you please suggest where is null values is getting in thread? this code worked fine previously but after little changes in code this error showed up.
Code Snippet:
public class soms1 extends JApplet {
static public SOM_thread1 thread = null;
static JApplet japplet = new JApplet();
static JButton go1 = new JButton("go");
static JButton play = new JButton("play");
static JButton reset = new JButton("Reset");
static JButton send = new JButton("send");
static Container c;
static JPanel p1 = new JPanel();
static JPanel p2 = new JPanel();
static JPanel p6 = new JPanel();
Toolkit tool;
public void setup_applet() {
    japplet.setVisible(true);
    go1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {thread.set_state(1);}
    });
    play.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {thread.set_state(2);}
    });
    reset.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {thread.reset();}
    });
    send.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {thread.send();}
    });
}
public void init() {
    tool = Toolkit.getDefaultToolkit();
    setup_applet();
    setup_radios();
    setup_layout();
    thread = new SOM_thread1();
    thread.init();
    thread.start();
    if (clientSocket != null) {thread.set_state(2);}
   }
}
class SOM_thread1 extends Thread{
public void set_state(int f) {state = f;}
public void send() { //code block}
public void reset() {//code block}
public void run() {//code block}
public void init() {reset();}
}
As i am newbie in java please suggest changes thank you in advance.
 
     
    