?? client3.java
字號:
import java.awt.*;
import java.net.*;
import java.io.*;
import java.awt.event.*;
public class Client3 extends Frame{
private TextArea msgView=new TextArea();
private TextField sendBox=new TextField();
private DataInputStream reader;
private DataOutputStream writer;
Socket socket;
public Client3(String title){
super(title);
msgView.setEditable(false);
add(msgView,"Center");
add(sendBox,"South");
sendBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
try{
writer.writeUTF(sendBox.getText());
writer.flush();
String fileInfo=reader.readUTF();
msgView.setText("< " + sendBox.getText()+"狼 郴儈 >\n\n");
msgView.append(fileInfo);
sendBox.setText("");
}catch(Exception ie){}
}
});
pack();
}
private void connect(){
try{
msgView.append("輯滾家南苞狼 楷搬闌 矯檔欽聰促.\n");
socket=new Socket("127.0.0.1", 7777);
msgView.append("楷搬 肯豐... 焊絆酵籃 頗老狼 撈撫闌 澇仿竅技夸.\n");
reader=new DataInputStream(socket.getInputStream());
writer=new DataOutputStream(socket.getOutputStream());
}catch(Exception e){
msgView.append("楷搬 角菩..");
}
}
public static void main(String[] args){
Client3 client=new Client3("輯滾 矯膠袍 頗老 焊扁");
client.setVisible(true);
client.connect();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -