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

正文內(nèi)容

java課程設(shè)計(jì)之簡單聊天室-文庫吧資料

2025-07-05 07:28本頁面
  

【正文】 import .*。該類與前面所講的鏈表節(jié)點(diǎn)Node類的功能相當(dāng)。 } return pointer。 } else{ return null。 int i = 0。 } if(index 0) { return null。 } } return null。 while( != null){ pointer = 。 } /** * 根據(jù)用戶名查找用戶 */ public Node findUser(String username){ if(count == 0) return null。 } pointer = 。 count 。 } /** * 刪除用戶 */ public void delUser(Node n){ pointer = root。 = null。 while( != null){ pointer = 。 count = 0。 = null。 int count。/** * 用戶鏈表 */public class UserLinkList { Node root。該類通過構(gòu)造函數(shù)構(gòu)造用戶鏈表,定義了添加用戶、刪除用戶、返回用戶數(shù)、根據(jù)用戶名查找用戶、根據(jù)索引查找用戶這5個(gè)方法。 } i++。 ()。 ()。 continue。 while(i count){ Node node = (i)。 i++。 userlist += 39。 continue。 while(i count){ Node node = (i)。 int count = ()。 } i++。 ()。 ()。 continue。 while(i count){ Node node = (i)。 } } } /* * 向所有人發(fā)送消息 */ public void sendToAll(String msg){ int count = ()。//重新發(fā)送用戶列表,刷新 break。 sendToAll(msg)。 (msg)。 i++。 continue。 while(i count){ node = (i)。 (所有人)。 int count = ()。 (node)。 ()。 ()。 } Node node = (toSomebody)。 ()。 ()。 if((所有人)){ sendToAll(msg)。 if((悄悄話)){ msg = [悄悄話] + msg。 String message = (String)()。 String status = (String)()。 !()){ try{ String type = (String)()。 while(!isStop amp。 isStop = false。 = userLinkList。 = textfield。//用戶鏈表 public boolean isStop。 Node client。 JTextField textfield。import .*。 } catch(Exception e){ } } }}ServerReceive類功能:實(shí)現(xiàn)服務(wù)器消息收發(fā)的類,該類分別定義了向某用戶及所有人發(fā)送消息的方法,發(fā)送的消息會顯示在主界面類的街面上。 recvThread = new ServerReceive(textarea,textfield, bobox,client,userLinkList)。 (用戶 + + 上線 + \n)。 //顯示提示信息 ()。 = new ObjectInputStream(())。 = new ObjectOutputStream(())。 !()){ try{ client = new Node()。 } public void run(){ while(!isStop amp。 = userLinkList。 = textarea。 /* * 聊天服務(wù)端的用戶上線于下線偵聽類 */ public ServerListen(ServerSocket server,JComboBox bobox, JTextArea textarea,JTextField textfield,UserLinkList userLinkList){ = server。 ServerReceive recvThread。 UserLinkList userLinkList。 JTextArea textarea。/* * 服務(wù)端的偵聽類 */public class ServerListen extends Thread { ServerSocket server。import .*。代碼:package server。該類對用戶上線下線的監(jiān)聽是通過調(diào)用用戶鏈表類(UserLinkList)來實(shí)現(xiàn)的。 } new ChatServer()。 } catch (IllegalAccessException e) { // TODO Autogenerated catch block ()。 } catch (ClassNotFoundException e) { // TODO Autogenerated catch block ()。 } ()。 ()。 ()。 } else{ //向某個(gè)用戶發(fā)送消息 Node node = (toSomebody)。 (message)。 } /** * 向客戶端用戶發(fā)送消息 */ public void sendSystemMessage(){ String toSomebody = ().toString()。 } i++。 ()。 ()。 continue。 while(i count){ Node node = (i)。 } } /** * 向所有人發(fā)送消息 */ public void sendMsgToAll(String msg){ int count = ()。 } catch (Exception e){ //($$$+e)。 } try{ (服務(wù)關(guān)閉)。 if(node == null) { i ++。 int i = 0。 } catch(Exception e){ //(e)。 ()。 (false)。 (true)。 (true)。 } stopServer .setEnabled(false)。 ()。 .close()。 int i =0。 ()。 } /** * 關(guān)閉服務(wù)端 */ public void stopService(){ try{ //向所有人發(fā)送服務(wù)器關(guān)閉的消息 sendStopToAll()。 listenThread = new ServerListen(serverSocket,bobox, messageShow,showStatus,userLinkList)。 } catch (Exception e){ //(e)。 stopItem .setEnabled(true)。 (false)。 (false)。 (服務(wù)端已經(jīng)啟動,在+port+端口偵聽...\n)。 } else if (obj == sysMessage || obj == sysMessageButton) { //發(fā)送系統(tǒng)消息 sendSystemMessage()。 } } else if (obj == helpItem) { //菜單欄中的幫助 //調(diào)出幫助對話框 Help helpDialog = new Help(this)。 if (j == ){ stopService()。 (true)。 if (j == ){ stopService()。 if (obj == startServer || obj == startItem) { //啟動服務(wù)端 startService()。 } } )。 //關(guān)閉程序時(shí)的操作 ( new WindowAdapter(){ public void windowClosing(WindowEvent e){ stopService()。 (messageScrollPane,)。 (showStatus,girdBagCon)。 = 4。 girdBagCon = new GridBagConstraints()。 (sysMessageButton,girdBagCon)。 = 2。 (sysMessage)。 = 3。 girdBagCon = new GridBagConstraints()。 (messageLabel,girdBagCon)。 = 0。 (bobox)。 = 。 =1。 (sendToLabel)。 = 5。 = new Insets(1,0,0,0)。 = 0。 (none)。 JLabel none = new JLabel( )。 = 5。 = 3。 = 0。 (girdBag)。 downPanel = new JPanel()。 sendToLabel = new JLabel(發(fā)送至:)。 //添加系統(tǒng)消息的事件偵聽 (this)。 sysMessageButton = new JButton()。 sysMessage = new JTextField(24)。 showStatus = new JTextField(35)。 (new Dimension(400,400))。 (false)。 (0)。 bobox = new JComboBox()。 (this)。 //添加按鈕的事件偵聽 (this)。 (this)。 (this)。 stopItem .setEnabled(false)。 (toolBar,)。 ()。//添加分隔欄 (startServer)。 //將按鈕添加到工具欄 (portSet)。 stopServer = new JButton(停止服務(wù) )。 //初始化按鈕 portSet = new JButton(端口設(shè)置)。 (helpMenu)。 (serviceMenu)。 (stopItem)。 //添加菜單欄 (portItem)。 } /** * 程序初始化函數(shù) */ public void init(){ Container contentPane = getContentPane()。)。 //為幫助設(shè)置快捷鍵為ctrl+p (39。H39。H39。 ( (,))。X39。 ( (,))。T39。 ( (,))。S39。 ( (,))。P39。)。 (39。 //為服務(wù)菜單欄設(shè)置熱鍵39。 (聊天室服務(wù)端)。 ( (int) ( ()) / 2, (int) ( ()) / 2)。 //設(shè)置框架的大小 (faceSize)。//初始化程序 //添加框架的關(guān)閉事件處理 ()。 GridBagConstraints girdBagCon。 JPanel downPanel 。//退出按鈕 //框架的大小 Dimension faceSize = new Di
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1