mình mới học lập trình java, đang code bài chat giữa hai máy, nhưng ko thể hiển thị phận nội dung chat lên jtexarea được mong mọi người giúp đỡ.
đây là code của mình:

Mã:
package person1chat; import java.io.BufferedReader;import java.io.DataOutputStream;import java.io.IOException;import java.io.InputStreamReader;import java.net.ServerSocket;import java.net.Socket;import java.util.logging.Level;import java.util.logging.Logger; public class Gui extends javax.swing.JFrame {        static public String a;    static int port;    private ServerSocket svsoc;    private SendThread sendth;    private ReplyThread reth;    static Socket connectosv;    static DataOutputStream opp1;    static String k = null;    static Socket soc1;    static Socket connect;    public Gui() {        initComponents();    }        @SuppressWarnings("unchecked")    // <editor-fold defaultstate="collapsed" desc="Generated Code">    private void initComponents() {         jScrollPane2 = new javax.swing.JScrollPane();        jTextArea2 = new javax.swing.JTextArea();        jButton1 = new javax.swing.JButton();        jScrollPane1 = new javax.swing.JScrollPane();        jTextArea1 = new javax.swing.JTextArea();         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);        setTitle("Ronaldo-Chat");         jTextArea2.setColumns(20);        jTextArea2.setLineWrap(true);        jTextArea2.setRows(5);        jTextArea2.setWrapStyleWord(true);        jScrollPane2.setViewportView(jTextArea2);         jButton1.setText("send");        jButton1.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton1ActionPerformed(evt);            }        });         jTextArea1.setColumns(20);        jTextArea1.setLineWrap(true);        jTextArea1.setRows(5);        jTextArea1.setWrapStyleWord(true);        jScrollPane1.setViewportView(jTextArea1);        jTextArea1.setEditable(false);         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());        getContentPane().setLayout(layout);        layout.setHorizontalGroup(            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(layout.createSequentialGroup()                .addContainerGap()                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING)                    .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING))                .addGap(27, 27, 27)                .addComponent(jButton1)                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))        );        layout.setVerticalGroup(            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(layout.createSequentialGroup()                .addContainerGap()                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE)                        .addGap(18, 18, 18)                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)                        .addContainerGap())                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()                        .addComponent(jButton1)                        .addGap(20, 20, 20))))        );         pack();    }// </editor-fold> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                             a = jTextArea2.getText();    jTextArea2.setText(null);    while (a != null) {        try {            send(a); // day du lieu cho ban chat.        } catch (IOException ex) {            Logger.getLogger(Gui.class.getName()).log(Level.SEVERE, null, ex);        }        a = null;    }}                                                public static void main(String args[]) throws IOException {       java.awt.EventQueue.invokeLater(new Runnable() {                        @Override            public void run() {                new Gui().setVisible(true);                            }        });        Gui g = new Gui();        port = 11;        connectosv = new Socket("127.0.0.1", 20);        try {            opp1 = new DataOutputStream(connectosv.getOutputStream()); // day du lieu cho client        } catch (IOException ex) {            Logger.getLogger(Gui.class.getName()).log(Level.SEVERE, null, ex);        }        BufferedReader in = new BufferedReader(new InputStreamReader(connectosv.getInputStream()));                k = in.readLine();        // neu chua co may nao ket noi den. may nay se la server. co cong port.        if (k.equals("0")) {            //day cong server cho server            String t;            t = port + "";            opp1.writeBytes(t);            opp1.write(13);            opp1.write(10);            opp1.flush();                        opp1.close();            // lang nghe client            ServerSocket sv = new ServerSocket(port);            soc1 = new Socket();            System.out.print("waiting . . .. 
");            soc1 = sv.accept();            System.out.print("connected.");                   } else  {// co may khac da ket noi voi  may chu thi thi may se la client            // chuyen du lieu ve int.            int portt;            portt = Integer.parseInt(k);            soc1 = new Socket("127.0.0.1", portt);            System.out.print("connected");        }        g.recive();            }    // gui du lieu den may chat.     public void send(String s) throws IOException {        DataOutputStream op = new DataOutputStream(soc1.getOutputStream());        op.writeBytes(s);        op.writeChar(13);        op.writeByte(10);        op.flush();    }     public void recive() throws IOException {        BufferedReader in1 = new BufferedReader(new InputStreamReader(soc1.getInputStream()));        String s;        while (true) {            s = in1.readLine();            if (s.equals("") == false) {                System.out.print(s);                // mình định hiển thị lên jTextArea1 nội dung chat ở chỗ này                Gui g = new Gui();                g.jTextArea2.append("g");            }        }    }    // Variables declaration - do not modify    private javax.swing.JButton jButton1;    private javax.swing.JScrollPane jScrollPane1;    private javax.swing.JScrollPane jScrollPane2;    private javax.swing.JTextArea jTextArea1;    private javax.swing.JTextArea jTextArea2;    // End of variables declaration}