資源簡介
計算機網絡實驗 本程序主要實現兩方面功能: 1 聊天:兩方可互相發送文本消息 并顯示在界面上 2 發送文件:一方請求發送文件 對方可拒絕 也可接收 如果拒絕 則不傳輸文件 如果接收 則將所選擇的文件發送給對方 ">計算機網絡實驗 本程序主要實現兩方面功能: 1 聊天:兩方可互相發送文本消息 并顯示在界面上 2 發送文件:一方請求發送文件 對方可拒絕 也可接收 如果拒絕 則不傳輸文件 如果接收 則將所選擇的文件發送給對方 [更多]
代碼片段和文件信息
import?java.awt.Dimension;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?java.awt.event.KeyEvent;
import?java.awt.event.KeyListener;
import?java.io.*;
import?java.net.*;
import?javax.swing.JButton;
import?javax.swing.JFileChooser;
import?javax.swing.Jframe;
import?javax.swing.JLabel;
import?javax.swing.JOptionPane;
import?javax.swing.JPanel;
import?javax.swing.JScrollPane;
import?javax.swing.JTextArea;
public?class?ChatWindow?extends?Jframe?{
private?Socket?clientSocket;
private?String?nickname;
private?String?otherNickname;
private?JPanel?chatLogPanel;
private?JPanel?buttonPanel;
public?JTextArea?chatLog;
private?JScrollPane?chatLogRange;
private?JTextArea?inputBox;
private?JButton?sendMessageButton;
private?JButton?sendFileButton;
public?ChatWindow(Socket?socket?String?my_nickname?String?other_nickname)?{
this.clientSocket?=?socket;
this.nickname?=?my_nickname;
this.otherNickname?=?other_nickn
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????.CA....???????301??2013-11-26?16:41??NW_Socket\.classpath
????.CA....???????385??2013-11-26?16:41??NW_Socket\.project
????.CA....???????598??2013-11-26?16:41??NW_Socket\.settings\org.eclipse.jdt.core.prefs
????.CA....??????1706??2013-12-07?20:03??NW_Socket\bin\ChatWindow$1.class
????.CA....??????1716??2013-12-07?20:03??NW_Socket\bin\ChatWindow$2.class
????.CA....???????799??2013-12-07?20:03??NW_Socket\bin\ChatWindow$3.class
????.CA....??????2861??2013-12-07?20:03??NW_Socket\bin\ChatWindow.class
????.CA....??????1875??2013-12-01?20:14??NW_Socket\bin\ClientThread.class
????.CA....??????1944??2013-11-29?21:08??NW_Socket\bin\ClientThreadForConsole.class
????.CA....??????1993??2013-11-29?21:08??NW_Socket\bin\ConsoleVersion.class
????.CA....???????439??2013-11-29?21:08??NW_Socket\bin\MainWork.class
????.CA....??????2637??2013-12-07?19:39??NW_Socket\bin\OpenChatWindow.class
????.CA....??????4883??2013-12-03?23:05??NW_Socket\bin\ReceiveFileThread.class
????.CA....??????4861??2013-12-03?23:05??NW_Socket\bin\SendFileThread.class
????.CA....??????1856??2013-12-01?20:14??NW_Socket\bin\ServerThread.class
????.CA....??????2055??2013-11-29?21:08??NW_Socket\bin\ServerThreadForConsole.class
????.CA....??????2101??2013-12-07?16:10??NW_Socket\bin\StartupWindow$1.class
????.CA....??????2416??2013-12-07?16:10??NW_Socket\bin\StartupWindow$2.class
????.CA....??????2626??2013-12-07?16:10??NW_Socket\bin\StartupWindow.class
????.CA....??????3764??2013-12-07?20:03??NW_Socket\src\ChatWindow.java
????.CA....??????1302??2013-12-01?20:14??NW_Socket\src\ClientThread.java
????.CA....???????121??2013-11-27?18:21??NW_Socket\src\MainWork.java
????.CA....??????1701??2013-12-07?19:39??NW_Socket\src\OpenChatWindow.java
????.CA....??????4726??2013-12-03?23:05??NW_Socket\src\ReceiveFileThread.java
????.CA....??????4312??2013-12-03?23:05??NW_Socket\src\SendFileThread.java
????.CA....??????1153??2013-12-01?20:14??NW_Socket\src\ServerThread.java
????.CA....??????5180??2013-12-07?16:10??NW_Socket\src\StartupWindow.java
????.C.D...?????????0??2014-01-25?13:30??NW_Socket\.settings
????.C.D...?????????0??2014-01-28?21:09??NW_Socket\bin
????.C.D...?????????0??2014-01-28?21:10??NW_Socket\src
............此處省略4個文件信息
- 上一篇:sql+java 圖書管理系統
- 下一篇:java swing版掃雷游戲源碼
評論
共有 條評論