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

正文內(nèi)容

畢業(yè)設(shè)計(jì)(論文)-基于java的多人聊天室設(shè)計(jì)-資料下載頁(yè)

2025-06-05 06:05本頁(yè)面
  

【正文】 o().equals(id)){ return true。 } } return false。 } public String getUserInfoByTreeNode(DefaultMutableTreeNode node){ if(allTreeNodes!=nullamp。amp。()0){ for(int i =0。i()。i++){ if(((i).getDmtn())){ return (i).getUserInfo()。 } } } return null。 } //初始化好友樹(shù)的方法 public DefaultMutableTreeNode initTree(){ DefaultMutableTreeNode root = new DefaultMutableTreeNode (好友列表 (+me+))。 if(!=nullamp。amp。()0){ ()。 for(int i =0。i()。i++){ //不將自己放在好友列表上 if((i).equals(me)){ continue。 } DefaultMutableTreeNode friend = new DefaultMutableTreeNode ((i))。 TalkingMainTreeInfo treeNodeInfo = new TalkingMainTreeInfo((i),friend)。 (treeNodeInfo)。 (friend)。 } } return root。 } } 聊天窗口 和文件傳輸 界面 服務(wù)器 端 和客戶(hù) 端 通過(guò) I/O 流,在建立 用戶(hù)建立 會(huì)話(huà)之前, 會(huì) 先建立一個(gè) socket 連接, 用來(lái) 接收 請(qǐng)求和發(fā)送請(qǐng)求消息,用戶(hù)之間的數(shù)據(jù)傳輸是通過(guò) Socket 連接服務(wù)器端然后轉(zhuǎn)給另一個(gè)服務(wù)器端的,其中我們通過(guò)流來(lái)翻譯字節(jié)和復(fù)制字符然后傳輸給用戶(hù),和傳輸文件的原理是差不多的。 關(guān)鍵代碼: public class TalkWindow { private JFrame jFrame = null。 // @jve:declindex=0:visualconstraint=168,56 private JPanel jContentPane = null。 private JPanel jPanel = null。 private JTextField jTextField = null。 private JButton jButton = null。 private JScrollPane jScrollPane = null。 private JTextArea jTextArea = null。 private LinkInfo linkInfo。 private String me。 private String target。 private OutputStream out。// 連接服務(wù)器端的輸出流 // 準(zhǔn)備傳送的文件 private File readyforsendfile。 // 準(zhǔn)備接收的文件 private File readyfetFile。 /** * This method initializes jScrollPane * * @return */ private JScrollPane getJScrollPane() { if (jScrollPane == null) { jScrollPane = new JScrollPane()。 (new Rectangle(1, 1, 336, 194))。 (getJTextArea())。 } return jScrollPane。 } // 關(guān)閉窗口的同時(shí)刪除聊天窗口信息 public void closeFrameAndClearTalkWindowInfo() { for (int i = 0。 i ().size()。 i++) { if (().get(i).getTalkingWindow() .equals(this)) { ().remove(i)。 break。 } } ()。 } // 關(guān)閉聊天窗口 public void closeFrame() { ()。 } /** * This method initializes jTextArea * * @return */ private JTextArea getJTextArea() { if (jTextArea == null) { jTextArea = new JTextArea()。 (true)。 (false)。 } return jTextArea。 } public TalkWindow(String me, String target, LinkInfo linkInfo) { ().setVisible(true)。 = me。 = target。 = linkInfo。 if ((ALL)) { (群聊中 ...)。 } else { (與 + target + 聊天中 ...)。 } try { out = ().getOutputStream()。 } catch (IOException e) { // TODO 自動(dòng)生成 catch 塊 ()。 } } /** * This method initializes jFrame * * @return */ private JFrame getJFrame() { if (jFrame == null) { jFrame = new JFrame()。 (null)。 (new Dimension(361, 349))。 (false)。 (getJContentPane())。 (new () { public void windowClosing( e) { ()。 removeTalkWindowInfo()。 } })。 } return jFrame。 } private void removeTalkWindowInfo() { for (int i = 0。 i ().size()。 i++) { if (().get(i).getTalkingWindow () .equals(this)) { ().remove(i)。 break。 } } } /** * This method initializes jContentPane * * @return */ private JPanel getJContentPane() { if (jContentPane == null) { jContentPane = new JPanel()。 (null)。 (getJPanel(), null)。 } return jContentPane。 } /** * This method initializes jPanel1 * * @return */ private JPanel getJPanel() { if (jPanel == null) { jPanel = new JPanel()。 (null)。 (new Rectangle(0, 1, 345, 310))。 (getJTextField(), null)。 (getJButton(), null)。 (true)。 (getJScrollPane(), null)。 } return jPanel。 } /** * This method initializes jTextField * * @return */ private JTextField getJTextField() { if (jTextField == null) { jTextField = new JTextField()。 (new Rectangle(5, 203, 333, 35))。 (new () { public void keyPressed( e) { if (() == ) { sendMessageToServer()。 } } })。 } return jTextField。 } /** * This method initializes jButton * * @return */ private JButton getJButton() { if (jButton == null) { jButton = new JButton()。 (new Rectangle(193, 254, 138, 49))。 (發(fā)送文件 )。 (new () { public void actionPerformed( e) { sendFile()。 } })。 } return jButton。 } public boolean sendMessageToServer() { // 如果已經(jīng)沒(méi)有好友在線(xiàn),則告知用戶(hù),此好友已下線(xiàn) if (().size() == 0) { (已無(wú)用戶(hù)在線(xiàn) ...\n)。 ().setValue( ().getMaximum())。 return false。 } // 沒(méi)有目標(biāo)對(duì)象就是群聊 if ((ALL)) { (, out)。 ((), out)。 (() + 我說(shuō) :\n + () + \n)。 ().setValue( ().getMaximum())。 ()。 return true。 } if (().size() 0) { boolean friendOnline = false。// 當(dāng)前聊 天對(duì)象是否在線(xiàn) for (int i = 0。 i ().size()。 i++) { if (().get(i).equals(target)) { friendOnline = true。 break。 } } // 如果當(dāng)前聊天對(duì)象不在線(xiàn),則告知用戶(hù),此好友已下線(xiàn) if (!friendOnline) { (() + + 已下線(xiàn) ..信息發(fā)送失敗 \n)。 ().setValue( ().getMaximum())。 return false。 } } // 如果輸入框中有信息,將聊天信息發(fā)送給服務(wù)器端 if (!().equals()) { (, out)。 (target, out)。 ((), out)。 (() + 我說(shuō) :\n + () + \n)。 ().setValue( ().getMaximum())。 ()。 return true。 } return false。 } // 將聊天信息顯示到聊天對(duì)話(huà)框中 public void showMessage(String message) { (() + target + 說(shuō) :\n + message + \n)。 ().setValue( ().getMaximum())。 } // 顯示群聊信息 public void show
點(diǎn)擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計(jì)相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1