freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

java課程設(shè)計(jì)之簡(jiǎn)單聊天室(存儲(chǔ)版)

  

【正文】 e{ return null。/** * 用戶鏈表的結(jié)點(diǎn)類 */public class Node { String username = null。import .*。 JLabel message = new JLabel()。 } private void jbInit() throws Exception { (new Dimension(300, 120))。 (message)。 (panelPort, )。 } = savePort。 //取消按鈕的事件處理 ( new ActionListener(){ public void actionPerformed(ActionEvent e){ ( 默認(rèn)端口號(hào)為:8888)。/** * 生成設(shè)置對(duì)話框的類 */public class Help extends JDialog { /** * */ private static final long serialVersionUID = 1L。 public Help(JFrame frame) { super(frame, true)。 (bg)。 (false)。 Container contentPane = getContentPane()。 }}ChatClient類功能:定義客戶端的界面,添加時(shí)間監(jiān)聽與事件處理。import .*。//客戶端的信息顯示 JScrollPane messageScrollPane。 ObjectOutputStream output。 JMenu conMenu=new JMenu (設(shè)置(C))。//用戶注銷 JButton userButton。//初始化程序 //添加框架的關(guān)閉事件處理 ()。 //為操作菜單欄設(shè)置熱鍵39。 ( (,))。 ( (,))。)。 (39。 (new BorderLayout())。 (helpItem)。 //當(dāng)鼠標(biāo)放上顯示信息 (連接到指定的服務(wù)器)。 (logoffButton)。 (高興地)。 //為菜單欄添加事件監(jiān)聽 (this)。 (this)。 //添加滾動(dòng)條 messageScrollPane = new JScrollPane(messageShow, , )。 (this)。 = 0。 (none)。 (sendToLabel)。 =2。 = 。 = 2。 = 3。 (clientMessage,girdBagCon)。 (false)。 (downPanel,)。 } else if (obj == connectItem || obj == connectButton) { //連接服務(wù)端設(shè)置 //調(diào)出連接設(shè)置對(duì)話框 ConnectConf conConf = new ConnectConf(this,ip,port)。 ()。\n請(qǐng)確認(rèn)連接設(shè)置是否正確。 recvThread = new ClientReceive(socket,output,input,bobox,messageShow,showStatus)。 (true)。 (true)。 if(()){ return 。//標(biāo)志位設(shè)為未連接 } catch (Exception e){ // } } public void SendMessage(){ String toSomebody = ().toString()。 (已經(jīng)與服務(wù)器斷開連接...\n)。 (false)。 return。 (false)。 (userName)。 } } public void Connect(){ try{ socket = new Socket(ip,port)。 ()。 (true)。 (showStatus)。 (clientMessageButton)。 = 3。 girdBagCon = new GridBagConstraints()。 girdBagCon = new GridBagConstraints()。 = 3。 (bobox)。 // = 5。 JLabel none = new JLabel( )。 (girdBag)。 (發(fā)送)。 messageShow = new JTextArea()。 //添加按鈕的事件偵聽 (this)。 //初始時(shí) (true)。 actionlist = new JComboBox()。 ()。 connectButton = new JButton(連接設(shè)置 )。 (connectItem)。 ( (,))。 //為幫助菜單欄設(shè)置熱鍵39。 //為用戶設(shè)置設(shè)置快捷鍵為ctrl+u (39。X39。I39。 (聊天室客戶端)。 GridBagConstraints girdBagCon。 //建立工具欄中的按鈕組件 JButton loginButton。 JMenuItem logoffItem = new JMenuItem (用戶注銷(L))。//發(fā)送消息 JTextField showStatus。//0表示未連接,1表示已連接 JComboBox bobox。import .*。 //事件處理 ( new ActionListener() { public void actionPerformed(ActionEvent e) { dispose()。 (close)。\n+ 信息狀態(tài)欄中顯示服務(wù)器當(dāng)前的啟動(dòng)與停止?fàn)顟B(tài)、+ 用戶發(fā)送的消息和\n 服務(wù)器端發(fā)送的系統(tǒng)消息。 } private void jbInit() throws Exception { (new Dimension(400, 200))。 JTextArea help = new JTextArea()。import .*。 //關(guān)閉對(duì)話框時(shí)的操作 ( new WindowAdapter(){ public void windowClosing(WindowEvent e){ ( 默認(rèn)端口號(hào)為:8888)。 ()。 Container contentPane = getContentPane()。 (取消)。 ( (int) ( 400) / 2 + 50, (int) ( 600) / 2 + 150)。 public static JLabel DLGINFO=new JLabel( 默認(rèn)端口號(hào)為:8888)。代碼:package server。import .*。 int i = 0。 } /** * 根據(jù)用戶名查找用戶 */ public Node findUser(String username){ if(count == 0) return null。 = null。 int count。 ()。 i++。 int count = ()。 continue。 sendToAll(msg)。 while(i count){ node = (i)。 ()。 ()。 String status = (String)()。 = userLinkList。 JTextField textfield。 (用戶 + + 上線 + \n)。 !()){ try{ client = new Node()。 /* * 聊天服務(wù)端的用戶上線于下線偵聽類 */ public ServerListen(ServerSocket server,JComboBox bobox, JTextArea textarea,JTextField textfield,UserLinkList userLinkList){ = server。/* * 服務(wù)端的偵聽類 */public class ServerListen extends Thread { ServerSocket server。 } new ChatServer()。 ()。 } /** * 向客戶端用戶發(fā)送消息 */ public void sendSystemMessage(){ String toSomebody = ().toString()。 continue。 } try{ (服務(wù)關(guān)閉)。 ()。 } stopServer .setEnabled(false)。 ()。 stopItem .setEnabled(true)。 } else if (obj == sysMessage || obj == sysMessageButton) { //發(fā)送系統(tǒng)消息 sendSystemMessage()。 if (j == ){ stopService()。 (messageScrollPane,)。 (sysMessageButton,girdBagCon)。 girdBagCon = new GridBagConstraints()。 = 。 = new Insets(1,0,0,0)。 = 5。 downPanel = new JPanel()。 sysMessage = new JTextField(24)。 (0)。 (this)。 ()。 //初始化按鈕 portSet = new JButton(端口設(shè)置)。 //添加菜單欄 (portItem)。H39。 ( (,))。 ( (,))。 //為服務(wù)菜單欄設(shè)置熱鍵39。//初始化程序 //添加框架的關(guān)閉事件處理 ()。//啟動(dòng)服務(wù)端偵聽 JButton stopServer。 JMenuItem startItem = new JMenuItem (啟動(dòng)服務(wù)(S))。//信息顯示的滾動(dòng)條 JTextField showStatus。import .*。所以在這個(gè)過程不能過于急躁,要很有耐心將程序反復(fù)調(diào)試,參考文獻(xiàn)[1] 張廣彬,孟紅蕊,[M].北京:清華大學(xué)出版社,2007,1.[2] [M].北京:中國(guó)水利水電出版社,2004,5.[3] 求是科技. Java信息管理系統(tǒng)開發(fā)實(shí)例導(dǎo)航[M].北京:人民郵電出版社,2005,4.[4] [M].北京:人民郵電出版社,2004,9.[5]廖衛(wèi)東Java程序設(shè)計(jì)實(shí)用指南[M].北京:機(jī)械工業(yè)出版社,[3][6]李衛(wèi)華,[M]北京:中國(guó)水利水電出版社,1996[5]致謝本次課程由上海杰普公司三為指導(dǎo)老師以及我們?nèi)握n老師郭老師精心輔導(dǎo),讓我們大家深刻的體會(huì)到理論與實(shí)際相結(jié)合的重要性與微妙之處。設(shè)計(jì)開始階段必須明確設(shè)計(jì)的目的與需求分析,總體設(shè)計(jì)要全面分析聊天室系統(tǒng)的架構(gòu)。 UserConf類圖412 UserConf類圖該類繼承自Jdialog,是用戶對(duì)鏈接到服務(wù)器時(shí)所顯示的用戶名進(jìn)行修改配置的類。 UserLinkList類圖48 UserLinkList類圖 用戶鏈表節(jié)點(diǎn)的具體實(shí)現(xiàn)類。4 系統(tǒng)設(shè)計(jì) 總體設(shè)計(jì) 系統(tǒng)類圖圖411 服務(wù)端系統(tǒng)類圖圖412 客戶端系統(tǒng)類圖 主要時(shí)序圖圖421 服務(wù)端主要時(shí)序類圖圖422 客戶端主要時(shí)序類圖 詳細(xì)設(shè)計(jì)聊天室服務(wù)器端的設(shè)計(jì)聊天室服務(wù)端主要包括7個(gè)類,放在server包中: ChatServer類圖43 ChatServer類圖包含名為ChatServer的public類,其主要功能為定義服務(wù)器端的界面,添加時(shí)間監(jiān)聽與時(shí)間處理。因?yàn)榉?wù)端和客戶端之間采用TCP協(xié)議進(jìn)行網(wǎng)絡(luò)通信,建立的是可靠的、端到端的網(wǎng)絡(luò)連接,所以可靠性和安全性都很好。本聊天系統(tǒng)以聊天交流為主,為廣大用戶提供一個(gè)借助網(wǎng)絡(luò)進(jìn)行人際交往的平臺(tái),也是網(wǎng)絡(luò)與現(xiàn)實(shí)最貼近的實(shí)用型網(wǎng)站。本文所介紹的網(wǎng)絡(luò)聊天系統(tǒng)是基于開放的JAVA應(yīng)用程序開發(fā)設(shè)計(jì)的,其主要特性是能動(dòng)態(tài)、實(shí)時(shí)的完成信息的傳遞,且
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評(píng)公示相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1