package connection; import javax.swing.*; import java.io.*; public class ClientReader implements Runnable { private BufferedReader in; private Thread t; private JTextArea txtChatArea; ClientReader(BufferedReader bf, JTextArea jta) { txtChatArea = jta; in = bf; t = new Thread(this); t.start(); } public void run() { String str; try { while ((str = in.readLine()) != null) { txtChatArea.append("El otro dice: " + str); } } catch(IOException e) { } } }