import java.awt.*;
import javax.swing.*;
import java.awt.event.*;import java.net.*;
import java.io.*;import javax.swing.*;
import java.awt.*;import java.awt.event.*;public class Chat extends JFrame implements ActionListener{private String []name={"localhost"};private JComboBox jcombobox4;private JButton jbutton_lj;
private JDialog0 dialog1;
public Chat(){
super("fdfd");
setLocation(0,0);
setSize(400,400);
setLayout(new FlowLayout());
jcombobox4=new JComboBox(name);
jbutton_lj=new JButton("连接");
add(jcombobox4);
add(jbutton_lj);
jbutton_lj.addActionListener(this);
setDefaultCloseOperation(3);setVisible(true);dialog1=new JDialog0(this);}public void actionPerformed(ActionEvent e){
if(e.getActionCommand()=="连接"){
dialog1.jdialog0.setVisible(true);}}class JDialog0 implements ActionListener{
public JDialog jdialog0;public JPanel jpanel0,jpanel1;public JPanel jpanel2,jpanel7;public JTextArea jtextarea0,jtextarea1; public JButton jbutton_dk,jbutton_fs;public JPanel jpanel3,jpanel4,jpanel5;public JButton jbutton_sx,jbutton_lj;public JComboBox jcombobox0,jcombobox1;public JLabel jlabel0;
public JTextArea jtextarea_empoty;
public JPanel jpanel6;public JButton jbutton_save,jbutton_vido;
private ServerSocket server;
private Socket client;
private BufferedReader cin;
private PrintWriter cout;String name;public JDialog0(Chat chat){jdialog0=new JDialog(chat,"dddfd",true);
jdialog0.setSize(500,500);
jdialog0.setLocation(0,0);
jpanel0=new JPanel(new BorderLayout());jtextarea0=new JTextArea(4000,100);jpanel0.add(new JScrollPane(jtextarea0),"Center");jpanel2=new JPanel(new BorderLayout());
jtextarea1=new JTextArea(6,30);
jpanel2.add(new JScrollPane(jtextarea1),"Center");
jpanel7=new JPanel(new GridLayout(2,1));
jbutton_dk=new JButton("发送");jbutton_fs=new JButton("断开");
jpanel7.add(jbutton_fs);jpanel7.add(jbutton_dk);
jpanel2.add(jpanel7,"East");
jpanel0.add(jpanel2,"South");jdialog0.add(jpanel0,"Center");
String str0[]={"localhost","fdfd","dfd"};String []str1={"dfdf","fdd","dfd"};
jpanel1=new JPanel(new BorderLayout());jpanel3=new JPanel(new GridLayout(2,1));jpanel4=new JPanel(new BorderLayout());
jpanel5=new JPanel(new FlowLayout(2));
jbutton_sx=new JButton("刷新");jcombobox0=new JComboBox(str0);jbutton_lj=new JButton("连接");
jpanel4.add(jbutton_sx,"West");jpanel4.add(jcombobox0,"Center");jpanel4.add(jbutton_lj,"East");jpanel3.add(jpanel4);
jlabel0=new JLabel("状态");jcombobox1=new JComboBox(str1);jpanel5=new JPanel();jpanel5.add(jlabel0);jpanel5.add(jcombobox1);
jpanel3.add(jpanel5);jpanel1.add(jpanel3,"North");
jtextarea_empoty=new JTextArea();jtextarea_empoty.setEditable(false);jpanel1.add(jtextarea_empoty,"Center");jpanel6=new JPanel(new GridLayout(1,2));jbutton_save=new JButton("保存聊天记录");jbutton_vido=new JButton("音码");jpanel6.add(jbutton_save);
jpanel6.add(jbutton_save);jpanel6.add(jbutton_vido);
jpanel1.add(jpanel6,"South");
jpanel1.setSize(84,500);
jdialog0.add(jpanel1,"East");jdialog0.setDefaultCloseOperation(1);jbutton_fs.addActionListener(this);
jbutton_dk.addActionListener(this);
name="dfdfd";try{
       client=new Socket((String)jcombobox0.getSelectedItem(),2001);
       cin=new BufferedReader(new InputStreamReader(client.getInputStream()));
       cout=new PrintWriter(client.getOutputStream(),true);
       
       cout.println("jhkh");
       receiver("连接 "+cin.readLine());
       String aline="";
       do
       {
       aline=cin.readLine();
       if(aline!=null&&!aline.equals("bye"))
           receiver(aline);
       }while(aline!=null&&!aline.equals("bye"));
       
       cout=null;
       cin.close();
       cout.close();
       client.close();
       }
    catch(IOException e){try{
       server=new ServerSocket(2001);
       client=server.accept();
       cin=new BufferedReader(new InputStreamReader(client.getInputStream()));
       cout=new PrintWriter(client.getOutputStream(),true);
       
       cout.println("kjlj");
       receiver("连接 "+cin.readLine());
       
       String aline="";
       do
       {
       aline=cin.readLine();
       if(aline!=null&&!aline.equals("bye"))           receiver(aline);
       }while(aline!=null&&!aline.equals("bye"));
       
       cout=null;
       cin.close();
       cout.close();
       client.close();
       server.close();
       }
    catch(IOException ee){}
    finally{}
}
    finally{}}
public  void receiver(String message){
jtextarea0.append(message+"\r\n");}
public void actionPerformed(ActionEvent e){
 
if(e.getActionCommand()=="断开"){dk();}
if(e.getActionCommand()=="发送"){fs();}}
public void dk(){
if(this.cout!=null){
this.cout.println(name+"断开");
this.cout.println("bye");
this.cout=null;
}
jtextarea0.append("我离线\n");
}
public void fs(){
if(this.cout!=null){
this.cout.println(name+"说"+jtextarea1.getText());
jtextarea0.append("我说:"+jtextarea1.getText()+"\n");
jtextarea1.setText("");
}else{
jtextarea0.append("已断开,不能发送消息!!!\n");
}}}
public static void main(String args[]){
new Chat();
}}

解决方案 »

  1.   

    setVisible(true); dialog1=new JDialog0(this); 
    这样后面那句执行不了
      

  2.   

    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;public class Chat extends JFrame implements ActionListener{private String []name={"localhost"};private JComboBox jcombobox4;private JButton jbutton_lj;
    private JDialog0 dialog1;
    public Chat(){
    super("fdfd");
    setLocation(0,0);
    setSize(400,400);
    setLayout(new FlowLayout());
    jcombobox4=new JComboBox(name);
    jbutton_lj=new JButton("连接");
    add(jcombobox4);
    add(jbutton_lj);
    jbutton_lj.addActionListener(this);
    setDefaultCloseOperation(3);setVisible(true);dialog1=new JDialog0(this);}public void actionPerformed(ActionEvent e){
    if(e.getActionCommand()=="连接"){
    dialog1.jdialog0.setVisible(true);}}
    class JDialog0 implements ActionListener{
    public JDialog jdialog0;public JPanel jpanel0,jpanel1;public JPanel jpanel2,jpanel7;public JTextArea jtextarea0,jtextarea1; public JButton jbutton_dk,jbutton_fs;public JPanel jpanel3,jpanel4,jpanel5;public JButton jbutton_sx,jbutton_lj;public JComboBox jcombobox0,jcombobox1;public JLabel jlabel0;
    public JTextArea jtextarea_empoty;
    public JPanel jpanel6;public JButton jbutton_save,jbutton_vido;
    private ServerSocket server;
    private Socket client;
    private BufferedReader cin;
    private PrintWriter cout;String name;public JDialog0(Chat chat){jdialog0=new JDialog(chat,"dddfd",true);
    jdialog0.setSize(500,500);
    jdialog0.setLocation(0,0);
    jpanel0=new JPanel(new BorderLayout());jtextarea0=new JTextArea(4000,100);jpanel0.add(new JScrollPane(jtextarea0),"Center");jpanel2=new JPanel(new BorderLayout());
    jtextarea1=new JTextArea(6,30);
    jpanel2.add(new JScrollPane(jtextarea1),"Center");
    jpanel7=new JPanel(new GridLayout(2,1));
    jbutton_dk=new JButton("发送");jbutton_fs=new JButton("断开");
    jpanel7.add(jbutton_fs);jpanel7.add(jbutton_dk);
    jpanel2.add(jpanel7,"East");
    jpanel0.add(jpanel2,"South");jdialog0.add(jpanel0,"Center");String str0[]={"localhost","fdfd","dfd"};String []str1={"dfdf","fdd","dfd"};
    jpanel1=new JPanel(new BorderLayout());jpanel3=new JPanel(new GridLayout(2,1));jpanel4=new JPanel(new BorderLayout());
    jpanel5=new JPanel(new FlowLayout(2));
    jbutton_sx=new JButton("刷新");jcombobox0=new JComboBox(str0);jbutton_lj=new JButton("连接");
    jpanel4.add(jbutton_sx,"West");jpanel4.add(jcombobox0,"Center");jpanel4.add(jbutton_lj,"East");jpanel3.add(jpanel4);
    jlabel0=new JLabel("状态");jcombobox1=new JComboBox(str1);jpanel5=new JPanel();jpanel5.add(jlabel0);jpanel5.add(jcombobox1);
    jpanel3.add(jpanel5);jpanel1.add(jpanel3,"North");
    jtextarea_empoty=new JTextArea();jtextarea_empoty.setEditable(false);jpanel1.add(jtextarea_empoty,"Center");jpanel6=new JPanel(new GridLayout(1,2));jbutton_save=new JButton("保存聊天记录");jbutton_vido=new JButton("音码");jpanel6.add(jbutton_save);
    jpanel6.add(jbutton_save);jpanel6.add(jbutton_vido);
    jpanel1.add(jpanel6,"South");
    jpanel1.setSize(84,500);
    jdialog0.add(jpanel1,"East");jdialog0.setDefaultCloseOperation(1);jbutton_fs.addActionListener(this);
    jbutton_dk.addActionListener(this);
    name="dfdfd";
    try{
           client=new Socket((String)jcombobox0.getSelectedItem(),2001);
           cin=new BufferedReader(new InputStreamReader(client.getInputStream()));
           cout=new PrintWriter(client.getOutputStream(),true);
           
           cout.println("jhkh");
           receiver("连接 "+cin.readLine());
           String aline="";
           do
           {
           aline=cin.readLine();
           if(aline!=null&&!aline.equals("bye"))
               receiver(aline);
           }while(aline!=null&&!aline.equals("bye"));
           
           cout=null;
           cin.close();
           cout.close();
           client.close();
           }
        catch(IOException e){try{
           server=new ServerSocket(2001);
           client=server.accept();
           cin=new BufferedReader(new InputStreamReader(client.getInputStream()));
           cout=new PrintWriter(client.getOutputStream(),true);
           
           cout.println("kjlj");
           receiver("连接 "+cin.readLine());
           
           String aline="";
           do
           {
           aline=cin.readLine();
           if(aline!=null&&!aline.equals("bye"))           receiver(aline);
           }while(aline!=null&&!aline.equals("bye"));
           
           cout=null;
           cin.close();
           cout.close();
           client.close();
           server.close();
           }
        catch(IOException ee){}
        finally{}
    }
        finally{}
    }public  void receiver(String message){
    jtextarea0.append(message+"\r\n");}public void actionPerformed(ActionEvent e){
     
    if(e.getActionCommand()=="断开"){dk();}
    if(e.getActionCommand()=="发送"){fs();}}
    public void dk(){
    if(this.cout!=null){
    this.cout.println(name+"断开");
    this.cout.println("bye");
    this.cout=null;
    }
    jtextarea0.append("我离线\n");
    }
    public void fs(){
    if(this.cout!=null){
    this.cout.println(name+"说"+jtextarea1.getText());
    jtextarea0.append("我说:"+jtextarea1.getText()+"\n");
    jtextarea1.setText("");
    }else{
    jtextarea0.append("已断开,不能发送消息!!!\n");
    }}}
    public static void main(String args[]){
    new Chat();
    }}
      

  3.   

    client=new Socket((String)jcombobox0.getSelectedItem(),2001); 
    它会去尝试连localhost(这个程序中),此时server端还没有初始化,因此这句话后面的也不会执行了,包括server端初始化代码,JDialog0 的初始化工作就阻塞在上面这句话了。你把client和server做成两个线程初始化JDialog0后启动这两个线程
      

  4.   

    我来试一下,你java不错啊一下就可以看出来了
      

  5.   

    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;public class Test extends JFrame implements ActionListener { private String[] name = { "localhost" }; private JComboBox jcombobox4; private JButton jbutton_lj; private JDialog0 dialog1; public Test() { super("fdfd");
    setLocation(0, 0);
    setSize(400, 400);
    setLayout(new FlowLayout());
    jcombobox4 = new JComboBox(name);
    jbutton_lj = new JButton("连接");
    add(jcombobox4);
    add(jbutton_lj);
    jbutton_lj.addActionListener(this);
    setDefaultCloseOperation(3); setVisible(true); } public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals("连接")) {
    if (dialog1 == null)
    dialog1 = new JDialog0(this);
    dialog1.jdialog0.setVisible(true);
    } } class JDialog0 implements ActionListener { public JDialog jdialog0;
    public JPanel jpanel0, jpanel1;
    public JPanel jpanel2, jpanel7;
    public JTextArea jtextarea0, jtextarea1;
    public JButton jbutton_dk, jbutton_fs;
    public JPanel jpanel3, jpanel4, jpanel5;
    public JButton jbutton_sx, jbutton_lj;
    public JComboBox jcombobox0, jcombobox1;
    public JLabel jlabel0;
    public JTextArea jtextarea_empoty;
    public JPanel jpanel6;
    public JButton jbutton_save, jbutton_vido;
    private ServerSocket server;
    private Socket client;
    private BufferedReader cin;
    private PrintWriter cout;
    String name; public JDialog0(Test chat) {
    jdialog0 = new JDialog(chat, "dddfd", true);
    jdialog0.setSize(500, 500);
    jdialog0.setLocation(0, 0); jpanel0 = new JPanel(new BorderLayout());
    jtextarea0 = new JTextArea(4000, 100);
    jpanel0.add(new JScrollPane(jtextarea0), "Center"); jpanel2 = new JPanel(new BorderLayout());
    jtextarea1 = new JTextArea(6, 30);
    jpanel2.add(new JScrollPane(jtextarea1), "Center"); jpanel7 = new JPanel(new GridLayout(2, 1));
    jbutton_dk = new JButton("发送");
    jbutton_fs = new JButton("断开");
    jpanel7.add(jbutton_fs);
    jpanel7.add(jbutton_dk);
    jpanel2.add(jpanel7, "East");
    jpanel0.add(jpanel2, "South");
    jdialog0.add(jpanel0, "Center"); String str0[] = { "localhost", "fdfd", "dfd" };
    String[] str1 = { "dfdf", "fdd", "dfd" };
    jpanel1 = new JPanel(new BorderLayout());
    jpanel3 = new JPanel(new GridLayout(2, 1));
    jpanel4 = new JPanel(new BorderLayout());
    jpanel5 = new JPanel(new FlowLayout(2));
    jbutton_sx = new JButton("刷新");
    jcombobox0 = new JComboBox(str0);
    jbutton_lj = new JButton("连接");
    jpanel4.add(jbutton_sx, "West");
    jpanel4.add(jcombobox0, "Center");
    jpanel4.add(jbutton_lj, "East");
    jpanel3.add(jpanel4); jlabel0 = new JLabel("状态");
    jcombobox1 = new JComboBox(str1);
    jpanel5 = new JPanel();
    jpanel5.add(jlabel0);
    jpanel5.add(jcombobox1);
    jpanel3.add(jpanel5);
    jpanel1.add(jpanel3, "North"); jtextarea_empoty = new JTextArea();
    jtextarea_empoty.setEditable(false);
    jpanel1.add(jtextarea_empoty, "Center"); jpanel6 = new JPanel(new GridLayout(1, 2));
    jbutton_save = new JButton("保存聊天记录");
    jbutton_vido = new JButton("音码");
    jpanel6.add(jbutton_save);
    jpanel6.add(jbutton_save);
    jpanel6.add(jbutton_vido);
    jpanel1.add(jpanel6, "South");
    jpanel1.setSize(84, 500);
    jdialog0.add(jpanel1, "East"); jdialog0.setDefaultCloseOperation(1); jbutton_fs.addActionListener(this);
    jbutton_dk.addActionListener(this); name = "dfdfd";
    startChat();
    } public void startChat() {
    Thread th1 = new Thread(new Runnable() { public void run() {
    try {
    client = new Socket((String) jcombobox0
    .getSelectedItem(), 2001);
    cin = new BufferedReader(new InputStreamReader(client
    .getInputStream()));
    cout = new PrintWriter(client.getOutputStream(), true); receiver("连接 " + cin.readLine());
    String aline = "";
    do {
    aline = cin.readLine();
    if (aline != null && !aline.equals("bye")) receiver(aline);
    } while (aline != null && !aline.equals("bye")); cout = null;
    cin.close();
    cout.close();
    client.close();
    } catch (IOException e) {
    }
    } });
    Thread th2 = new Thread(new Runnable() { public void run() {
    try {
    server = new ServerSocket(2001);
    client = server.accept();
    cin = new BufferedReader(new InputStreamReader(client
    .getInputStream()));
    cout = new PrintWriter(client.getOutputStream(), true);
    receiver("连接 " + cin.readLine()); String aline = "";
    do {
    aline = cin.readLine();
    if (aline != null && !aline.equals("bye")) receiver(aline);
    } while (aline != null && !aline.equals("bye")); cout = null;
    cin.close();
    cout.close();
    client.close();
    server.close();
    } catch (IOException ee) {
    } finally {
    }
    } });
    th1.start();
    th2.start(); } public void receiver(String message) {
    jtextarea0.append(message + "\r\n"); } public void actionPerformed(ActionEvent e) { if (e.getActionCommand() == "断开") {
    dk();
    }
    if (e.getActionCommand() == "发送") {
    fs();
    } } public void dk() {
    if (this.cout != null) {
    this.cout.println(name + "断开");
    this.cout.println("bye");
    this.cout = null;
    }
    jtextarea0.append("我离线\n");
    } public void fs() {
    if (this.cout != null) {
    this.cout.println(name + "说" + jtextarea1.getText());
    jtextarea0.append("我说:" + jtextarea1.getText() + "\n");
    jtextarea1.setText("");
    } else {
    jtextarea0.append("已断开,不能发送消息!!!\n");
    } } } public static void main(String args[]) {
    new Test();
    }}不要光看代码,要看看一些编程的规范,。呵呵,好好学习天天向上
      

  6.   

    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;public class Test extends JFrame implements ActionListener {    private String[] name = { "localhost" };    private JComboBox jcombobox4;    private JButton jbutton_lj;    private JDialog0 dialog1;    public Test() {        super("fdfd");
            setLocation(0, 0);
            setSize(400, 400);
            setLayout(new FlowLayout());
            jcombobox4 = new JComboBox(name);
            jbutton_lj = new JButton("连接");
            add(jcombobox4);
            add(jbutton_lj);
            jbutton_lj.addActionListener(this);
            setDefaultCloseOperation(3);        setVisible(true);    }    public void actionPerformed(ActionEvent e) {
            if (e.getActionCommand().equals("连接")) {
                if (dialog1 == null)
                    dialog1 = new JDialog0(this);
                dialog1.jdialog0.setVisible(true);
            }    }    class JDialog0 implements ActionListener {        public JDialog jdialog0;
            public JPanel jpanel0, jpanel1;
            public JPanel jpanel2, jpanel7;
            public JTextArea jtextarea0, jtextarea1;
            public JButton jbutton_dk, jbutton_fs;
            public JPanel jpanel3, jpanel4, jpanel5;
            public JButton jbutton_sx, jbutton_lj;
            public JComboBox jcombobox0, jcombobox1;
            public JLabel jlabel0;
            public JTextArea jtextarea_empoty;
            public JPanel jpanel6;
            public JButton jbutton_save, jbutton_vido;
            private ServerSocket server;
            private Socket client;
            private BufferedReader cin;
            private PrintWriter cout;
            String name;        public JDialog0(Test chat) {
                jdialog0 = new JDialog(chat, "dddfd", true);
                jdialog0.setSize(500, 500);
                jdialog0.setLocation(0, 0);            jpanel0 = new JPanel(new BorderLayout());
                jtextarea0 = new JTextArea(4000, 100);
                jpanel0.add(new JScrollPane(jtextarea0), "Center");            jpanel2 = new JPanel(new BorderLayout());
                jtextarea1 = new JTextArea(6, 30);
                jpanel2.add(new JScrollPane(jtextarea1), "Center");            jpanel7 = new JPanel(new GridLayout(2, 1));
                jbutton_dk = new JButton("发送");
                jbutton_fs = new JButton("断开");
                jpanel7.add(jbutton_fs);
                jpanel7.add(jbutton_dk);
                jpanel2.add(jpanel7, "East");
                jpanel0.add(jpanel2, "South");
                jdialog0.add(jpanel0, "Center");            String str0[] = { "localhost", "fdfd", "dfd" };
                String[] str1 = { "dfdf", "fdd", "dfd" };
                jpanel1 = new JPanel(new BorderLayout());
                jpanel3 = new JPanel(new GridLayout(2, 1));
                jpanel4 = new JPanel(new BorderLayout());
                jpanel5 = new JPanel(new FlowLayout(2));
                jbutton_sx = new JButton("刷新");
                jcombobox0 = new JComboBox(str0);
                jbutton_lj = new JButton("连接");
                jpanel4.add(jbutton_sx, "West");
                jpanel4.add(jcombobox0, "Center");
                jpanel4.add(jbutton_lj, "East");
                jpanel3.add(jpanel4);            jlabel0 = new JLabel("状态");
                jcombobox1 = new JComboBox(str1);
                jpanel5 = new JPanel();
                jpanel5.add(jlabel0);
                jpanel5.add(jcombobox1);
                jpanel3.add(jpanel5);
                jpanel1.add(jpanel3, "North");            jtextarea_empoty = new JTextArea();
                jtextarea_empoty.setEditable(false);
                jpanel1.add(jtextarea_empoty, "Center");            jpanel6 = new JPanel(new GridLayout(1, 2));
                jbutton_save = new JButton("保存聊天记录");
                jbutton_vido = new JButton("音码");
                jpanel6.add(jbutton_save);
                jpanel6.add(jbutton_save);
                jpanel6.add(jbutton_vido);
                jpanel1.add(jpanel6, "South");
                jpanel1.setSize(84, 500);
                jdialog0.add(jpanel1, "East");            jdialog0.setDefaultCloseOperation(1);            jbutton_fs.addActionListener(this);
                jbutton_dk.addActionListener(this);            name = "dfdfd";
                startChat();
            }        public void startChat() {
                Thread th1 = new Thread(new Runnable() {                public void run() {
                        try {
                            client = new Socket((String) jcombobox0
                                    .getSelectedItem(), 2001);
                            cin = new BufferedReader(new InputStreamReader(client
                                    .getInputStream()));
                            cout = new PrintWriter(client.getOutputStream(), true);                        receiver("连接 " + cin.readLine());
                            String aline = "";
                            do {
                                aline = cin.readLine();
                                if (aline != null && !aline.equals("bye"))                                receiver(aline);
                            } while (aline != null && !aline.equals("bye"));                        cout = null;
                            cin.close();
                            cout.close();
                            client.close();
                        } catch (IOException e) {
    Thread th2 = new Thread(new Runnable() {                public void run() {
                        try {
                            server = new ServerSocket(2001);
                            client = server.accept();
                            cin = new BufferedReader(new InputStreamReader(client
                                    .getInputStream()));
                            cout = new PrintWriter(client.getOutputStream(), true);
                            receiver("连接 " + cin.readLine());                        String aline = "";
                            do {
                                aline = cin.readLine();
                                if (aline != null && !aline.equals("bye"))                                receiver(aline);
                            } while (aline != null && !aline.equals("bye"));                        cout = null;
                            cin.close();
                            cout.close();
                            client.close();
                            server.close();
                        } catch (IOException ee) {
                        } finally {
                        }
                    }            });th2.start();
                        }
                    }            });
                
                th1.start();
                        }        public void receiver(String message) {
                jtextarea0.append(message + "\r\n");        }        public void actionPerformed(ActionEvent e) {            if (e.getActionCommand() == "断开") {
                    dk();
                }
                if (e.getActionCommand() == "发送") {
                    fs();
                }        }        public void dk() {
                if (this.cout != null) {
                    this.cout.println(name + "断开");
                    this.cout.println("bye");
                    this.cout = null;
                }
                jtextarea0.append("我离线\n");
            }        public void fs() {
                if (this.cout != null) {
                    this.cout.println(name + "说" + jtextarea1.getText());
                    jtextarea0.append("我说:" + jtextarea1.getText() + "\n");
                    jtextarea1.setText("");
                }            else {
                    jtextarea0.append("已断开,不能发送消息!!!\n");
                }        }    }    public static void main(String args[]) {
            new Test();
        }}