background image

IOException {

 

// TODO Auto-generated method stub

MyClient msv=

new

 MyClient();

}

 

 

public

 MyClient() 

throws

 UnknownHostException, IOException

{

jta=

new

 JTextArea();

 

//将文本面板附加到滚动面板上

jsp=

new

 JScrollPane(jta);

jtf=

new

 JTextField(10);

jb=

new

 JButton("发送");

jb.addActionListener(

this

);

 

 

jp1=

new

 JPanel();

jp1.add(jtf);

 jp1.add(jb);

 

this

.add(jsp,"Center");

 

this

.add(jp1,"South");

 

this

.setTitle("qq

 

简易聊天 客户端");

 

this

.setSize(300,200);

 

this

.setVisible(

true

);

 

Socket s=

new

 Socket("127.0.0.1",9988);

 

 

InputStreamReader isr=

new

 InputStreamReader(s.getInputStream());