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

正文內(nèi)容

java課程設(shè)計(jì)之簡單聊天室-免費(fèi)閱讀

2025-07-23 07:28 上一頁面

下一頁面
  

【正文】 type = 0。 (false)。 } } public void DisConnect(){ (true)。 (false)。 ()。 } catch (Exception e){ ( this,不能連接到指定的服務(wù)器。 } else if (obj == clientMessage || obj == clientMessageButton) { //發(fā)送消息 SendMessage()。 userName = 。 (messageScrollPane,)。 showStatus = new JTextField(35)。 = 1。 = 0。 = 4。 = 2。 girdBagCon = new GridBagConstraints()。 (sendToLabel,girdBagCon)。 (none,girdBagCon)。 girdBagCon = new GridBagConstraints()。 //添加系統(tǒng)消息的事件偵聽 (this)。 (false)。 (this)。 (false)。 (微笑地)。//添加分隔欄 (loginButton)。 exitButton = new JButton(退出 )。 (conMenu)。 } /** * 程序初始化函數(shù) */ public void init(){ Container contentPane = getContentPane()。H39。U39。)。)。 //設(shè)置標(biāo)題 setVisible(true)。 public ChatClient(){ init()。//用戶登錄 JButton logoffButton。 JMenuItem exitItem=new JMenuItem (退出(X))。//顯示用戶連接狀態(tài) Socket socket。//選擇發(fā)送消息的接受者 JTextArea messageShow。import .*。 } } )。 (new Label( ))。)。 (幫助)。 Color bg = new Color(255,255,255)。import .*。 } } )。 return。 (new BorderLayout())。 (new FlowLayout())。 (false)。 JPanel panelSave = new JPanel()。import .*。import .*。 while(i index + 1){ if( != null){ pointer = 。 pointer = root。 count++。 /** * 構(gòu)造用戶鏈表 */ public UserLinkList(){ root = new Node()。 } catch (Exception e){ //(e)。 } i = 0。 int i = 0。 } try{ (聊天信息)。//向所有人發(fā)送消息 sendUserList()。 if(node == null) { i ++。 } } } else if((用戶下線)){ Node node = ()。 (msg)。 String action = (String)()。 = bobox。 JComboBox bobox。 (在線用戶 + () + 人\n)。 = ()。 = bobox。 JComboBox bobox。 }}ServerListen類功能:實(shí)現(xiàn)服務(wù)器用戶上線與下線的監(jiān)聽。 } catch(Exception e){ //(!!!+e)。 String message = () + \n。 } try{ (系統(tǒng)信息)。 ()。 (所有人)。 stopItem .setEnabled(false)。 int count = ()。 (true)。 } } /** * 啟動服務(wù)端 */ public void startService(){ try{ serverSocket = new ServerSocket(port,10)。 } } else if (obj == portSet || obj == portItem) { //端口設(shè)置 //調(diào)出端口設(shè)置的對話框 PortConf portConf = new PortConf(this)。 (downPanel,)。 (sysMessageButton)。 = 1。 (bobox,girdBagCon)。 = 5。 = 5。 girdBag = new GridBagLayout()。 (false)。 messageShow = new JTextArea()。 (this)。//添加分隔欄 (exitButton)。 startServer = new JButton(啟動服務(wù))。 (startItem)。)。 //為退出設(shè)置快捷鍵為ctrl+x (39。 //為啟動服務(wù)快捷鍵為ctrl+s (39。V39。 ()。//關(guān)閉服務(wù)端偵聽 JButton exitButton。 JMenuItem stopItem=new JMenuItem (停止服務(wù)(T))。//顯示用戶連接狀態(tài) JLabel sendToLabel,messageLabel。import .*。使我們對java有了更深刻的認(rèn)識,產(chǎn)生濃厚的學(xué)習(xí)興趣。通過這次設(shè)計(jì),使我們認(rèn)識到體系的架構(gòu)是最重要的,只有準(zhǔn)確的系統(tǒng)設(shè)計(jì)、很好的定義各個(gè)模塊及模塊之間的關(guān)系,才能在編碼階段更輕松的的實(shí)現(xiàn)。 Help類圖413 Help類圖客戶端程序的幫助類。該類通過構(gòu)造函數(shù)構(gòu)造用戶鏈表,定義了添加用戶、刪除用戶、返回用戶數(shù)、根據(jù)用戶名查找用戶、根據(jù)索引查找用戶這5個(gè)方法。調(diào)用ServerListen類來實(shí)現(xiàn)服務(wù)端用戶上線與下線的監(jiān)聽,調(diào)用ServerListen來實(shí)現(xiàn)服務(wù)器端的消息收發(fā)。 系統(tǒng)用例圖圖31 系統(tǒng)用例圖 主要用例分析服務(wù)器端的主要功能如下:1,在特定端口上進(jìn)行偵聽,等待客戶端連接2,用戶可以配置服務(wù)端的偵聽端口,默認(rèn)端口為8888.3,向已經(jīng)連接到服務(wù)端的用戶發(fā)送系統(tǒng)消息。關(guān)鍵詞:(35個(gè),每個(gè)之間用分號隔開)聊天室;多線程;C/S模式Abstract The course design our chat room through the code, understand the theoretical knowledge and practical realization of the bination, the consolidation of javarelated methods. Chat client and the server is divided into two parts, the client, serverside program is mainly responsible for listening client sent the news to be landing the client to the server will be realized only if the normal chat. The chat system to exchangebased chat, in order to provide customers with a network platform for interpersonal munication, but also network with the reality of the practical is the closest site. Key words: Chat rooms, multithreaded, C / S mode簡單聊天室1 引言隨著互聯(lián)網(wǎng)逐步普及,人們的生活和工作也越來越離不開信息網(wǎng)絡(luò)的支持, 而聊天室是人們最常見, 最直接的網(wǎng)上交流的方式。本聊天系統(tǒng)以聊天交流為主,為廣大用戶提供一個(gè)借助網(wǎng)絡(luò)進(jìn)行人際交往的平臺,也是網(wǎng)絡(luò)與現(xiàn)實(shí)最貼近的實(shí)用型網(wǎng)站。4,統(tǒng)計(jì)在線人數(shù)5,當(dāng)停止服務(wù)時(shí),斷開所有的用戶連接。 ServerListen類圖44 ServerListen類圖 該類實(shí)現(xiàn)服務(wù)器用戶上線與下線的監(jiān)聽。 Node類圖49 Node類圖用戶鏈表的節(jié)點(diǎn)類,定義了鏈表中的用戶。 ClientReceive類圖414 ClientReceive類圖該類是實(shí)現(xiàn)服務(wù)器端與客戶端消息收發(fā)的類。通過這次課程設(shè)計(jì),對我們的邏輯思維能力是一個(gè)很大的鍛煉,它不僅加強(qiáng)了我們的系統(tǒng)思考問題的能力,而且還改變了我們以前不好的編程習(xí)慣,雖然花費(fèi)了不少的時(shí)間,但是我們學(xué)到了豐富的知識。我們由衷對他們表示感謝。/* * 聊天服務(wù)端的主框架類 */public class ChatServer extends JFrame implements ActionListener{ /** * */ private static final long serialVersionUID = 1L。 JTextField sysMessage。 JMenuItem exitItem=new JMenuItem (退出(X))。//退出按鈕 //框架的大小 Dimension faceSize = new Dimension(400, 600)。 //設(shè)置框架的大小 (faceSize)。 (39。S39。X39。 //為幫助設(shè)置快捷鍵為ctrl+p (39。 (stopItem)。 stopServer = new JButton(停止服務(wù) )。 (toolBar,)。 //添加按鈕的事件偵聽 (this)。 (false)。 sysMessageButton = new JButton()。 (girdBag)。 JLabel none = new JLabel( )。 = 5。 (bobox)。 = 3。 girdBagCon = new GridBagConstraints()。 //關(guān)閉程序時(shí)的操作 ( new WindowAdapter(){ public void windowClosing(WindowEvent e){ stopService()。 (true)。 (服務(wù)端已經(jīng)啟動,在+port+端口偵聽...\n)。 } catch (Exception e){ //(e)。 int i =0。 (true)。 } catch(Exception e){ //(e)。 } catch (Exception e){ //($$$+e)。 ()。 (message)。 } ()。該類對用戶上線下線的監(jiān)聽是通過調(diào)用用戶鏈表類(UserLinkList)來實(shí)現(xiàn)的。 JTextArea textarea。 = textarea。 = new ObjectOutputStream(())。 recvThread = new ServerReceive(textarea,textfield, bobox,client,userLinkList)。 Node client。 isStop = false。 String message = (String)()。 ()。 (node)。 continue。//重新發(fā)送用戶列表,刷新 break。 ()。 while(i count){ Node node = (i)。 while(i count){ Node node = (i)。 } i++。 = null。 } /** * 刪除用戶 */ public void delUser(Node n){ pointer = root。 while( != null){ pointer = 。 } els
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1