資源簡介
Java網絡編程 五子棋 課程設計
任務書
報告書
源程序
源代碼

代碼片段和文件信息
package?djr.chess.client;
import?java.awt.*;
import?java.awt.event.*;
import?java.io.*;
import?java.net.*;
import?javax.swing.Jframe;
import?djr.chess.gui.UserChatPad;
import?djr.chess.gui.UserControlPad;
import?djr.chess.gui.UserInputPad;
import?djr.chess.gui.UserListPad;
import?djr.chess.pad.FIRPad;
//?五子棋客戶端
public?class?FIRClient?extends?Jframe?implements?ActionListener?KeyListener
{
//?客戶端套接口
Socket?clientSocket;
//?數據輸入流
DataInputStream?inputStream;
//?數據輸出流
DataOutputStream?outputStream;
//?用戶名
String?chessClientName?=?null;
//?主機地址
String?host?=?null;
//?主機端口
int?port?=?4331;
//?是否在聊天
boolean?isOnChat?=?false;
????//?是否在下棋
boolean?isOnChess?=?false;
//?游戲是否進行中
boolean?isGameConnected?=?false;
//?是否為游戲創建者
boolean?isCreator?=?false;?
//?是否為游戲加入者
boolean?isParticipant?=?false;
//?用戶列表區
UserListPad?userListPad?=?new?UserListPad();
//?用戶聊天區
UserChatPad?userChatPad?=?new?UserChatPad();
//?用戶操作區
UserControlPad?userControlPad?=?new?UserControlPad();
//?用戶輸入區
UserInputPad?userInputPad?=?new?UserInputPad();
//?下棋區
FIRPad?firPad?=?new?FIRPad();
//?面板區
Panel?southPanel?=?new?Panel();
Panel?northPanel?=?new?Panel();
Panel?centerPanel?=?new?Panel();
Panel?eastPanel?=?new?Panel();
//?構造方法,創建界面
public?FIRClient()
{
super(“Java?五子棋客戶端“);
setLayout(new?BorderLayout());
host?=?userControlPad.ipInputted.getText();
eastPanel.setLayout(new?BorderLayout());
eastPanel.add(userListPad?BorderLayout.NORTH);
eastPanel.add(userChatPad?BorderLayout.CENTER);
eastPanel.setBackground(Color.LIGHT_GRAY);
userInputPad.contentInputted.addKeyListener(this);
firPad.host?=?userControlPad.ipInputted.getText();
centerPanel.add(firPad?BorderLayout.CENTER);
centerPanel.add(userInputPad?BorderLayout.SOUTH);
centerPanel.setBackground(Color.LIGHT_GRAY);
userControlPad.connectButton.addActionListener(this);
userControlPad.createButton.addActionListener(this);
userControlPad.joinButton.addActionListener(this);
userControlPad.cancelButton.addActionListener(this);
userControlPad.exitButton.addActionListener(this);
userControlPad.createButton.setEnabled(false);
userControlPad.joinButton.setEnabled(false);
userControlPad.cancelButton.setEnabled(false);
southPanel.add(userControlPad?BorderLayout.CENTER);
southPanel.setBackground(Color.LIGHT_GRAY);
addWindowListener(new?WindowAdapter()
{
public?void?windowClosing(WindowEvent?e)
{
if?(isOnChat)
{?//?聊天中
try
{??//?關閉客戶端套接口
clientSocket.close();
}
catch?(Exception?ed){}
}
if?(isOnChess?||?isGameConnected)
{?//?下棋中
try
{???//?關閉下棋端口
firPad.chessSocket.close();
}
catch?(Exception?ee){}
}
System.exit(0);
}
});
add(eastPanel?BorderLayout.EAST);
add(centerPanel?BorderLayout.CENTER);
add(southPanel?BorderLayout.SOUTH);
pack();
se
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????164864??2012-05-31?11:24??軟件0902?第二組?王琳?田瑩\任務書\課程設計任務書—王琳.doc
?????文件?????166400??2012-05-31?11:12??軟件0902?第二組?王琳?田瑩\任務書\課程設計任務書—田瑩.doc
?????文件?????813568??2012-06-11?12:56??軟件0902?第二組?王琳?田瑩\報告書\課程設計報告書--田瑩.doc
?????文件?????831488??2012-06-11?11:46??軟件0902?第二組?王琳?田瑩\報告書\課程設計報告書--王琳.doc
?????文件????????232??2008-01-19?11:16??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\.classpath
?????文件????????381??2008-01-19?11:16??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\.project
?????文件???????3795??2008-01-19?11:16??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\src\djr\chess\server\FIRServer.java
?????文件???????9720??2008-01-19?11:16??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\src\djr\chess\server\FIRServerThread.java
?????文件????????979??2008-01-19?11:16??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\src\djr\chess\server\ServerMsgPanel.java
?????文件??????19961??2008-01-19?11:16??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\src\djr\chess\pad\FIRPad.java
?????文件????????442??2008-01-19?11:16??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\src\djr\chess\pad\FIRPointBlack.java
?????文件????????420??2008-01-19?11:16??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\src\djr\chess\pad\FIRPointWhite.java
?????文件???????1761??2008-01-19?11:16??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\src\djr\chess\pad\FIRThread.java
?????文件????????522??2008-01-19?11:16??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\src\djr\chess\gui\UserChatPad.java
?????文件???????1044??2008-01-19?11:16??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\src\djr\chess\gui\UserControlPad.java
?????文件????????651??2008-01-19?11:16??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\src\djr\chess\gui\UserInputPad.java
?????文件????????532??2012-06-11?13:00??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\src\djr\chess\gui\UserListPad.java
?????文件??????10723??2008-01-19?11:16??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\src\djr\chess\client\FIRClient.java
?????文件???????3939??2008-01-19?11:16??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\src\djr\chess\client\FIRClientThread.java
?????文件????????700??2012-05-15?20:47??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\bin\djr\chess\server\FIRServer$1.class
?????文件???????4715??2012-05-15?20:47??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\bin\djr\chess\server\FIRServer.class
?????文件???????8139??2012-05-15?20:47??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\bin\djr\chess\server\FIRServerThread.class
?????文件???????1302??2012-05-15?20:47??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\bin\djr\chess\server\ServerMsgPanel.class
?????文件???????9942??2012-05-15?20:47??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\bin\djr\chess\pad\FIRPad.class
?????文件????????744??2012-05-15?20:47??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\bin\djr\chess\pad\FIRPointBlack.class
?????文件????????744??2012-05-15?20:47??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\bin\djr\chess\pad\FIRPointWhite.class
?????文件???????2278??2012-05-15?20:47??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\bin\djr\chess\pad\FIRThread.class
?????文件????????720??2012-05-15?20:47??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\bin\djr\chess\gui\UserChatPad.class
?????文件???????1371??2012-05-15?20:47??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\bin\djr\chess\gui\UserControlPad.class
?????文件???????1207??2012-05-15?20:47??軟件0902?第二組?王琳?田瑩\五子棋程序\五子棋socket\source_code\5ziqi\bin\djr\chess\gui\UserInputPad.class
............此處省略34個文件信息
評論
共有 條評論