/*******************************客户端****************************************/
package day13update;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
import java.net.Socket;
import java.net.UnknownHostException;
import javax.swing.*;
public class ClientSwing extends JFrame implements ActionListener, Runnable {
JButton jb1 = null;
JButton jb2 = null;
JTextArea jArea = null;
JTextField jField = null;
Socket socket1 = null;
Socket socket2 = null;
BufferedReader bReader = null;
DataInputStream dStream = null;
public static void main(String[] args) {
ClientSwing cSwing = new ClientSwing();
}
public ClientSwing() {
super("客户端");
jb1 = new JButton("发送");
jb1.addActionListener(this);
jb1.setSize(20, 10);
jb2 = new JButton("接收");
jb2.addActionListener(this);
jArea = new JTextArea();
jField = new JTextField();
this.add(jArea);
this.add(jb1);
// this.add(jb2);
this.add(jField);
// 设置布局格式
this.setLayout(new GridLayout(3, 1));
this.setVisible(true);
this.setSize(200, 260);
this.setLocation(300, 400);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);