My code is this:
public class clientsocket extends JFrame implements Runnable {
    public JTextArea chatbox;
    public clientsocket() {
        getContentPane().setLayout(null);
        chatbox = new JTextArea();
        chatbox.setBounds(20, 36, 404, 187);
        getContentPane().add(chatbox);
    }
    void checkconnection() {
        clientsocket obj1 = new clientsocket();
        Thread t1 = new Thread(obj1);
        t1.start();
    }
    public void run() {
        System.out.println("Step4");
        String responseLine;
        try {
            while ((responseLine = br.readLine()) != null) {
                System.out.println(responseLine);
                ipaddr.setText(responseLine);
                if (responseLine.indexOf("*** Bye") != -1) {
                    break;
                }
            }
        } catch (IOException e) {
            System.err.println("IOException:  " + e);
        }
    }
}
All the System.out.println() work properly in run() method. But I am unable to change the contents of the chatbox from within the run() method.
Why am I not able to access the chatbox in run() method?
 
     
    
