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

正文內(nèi)容

java課程設(shè)計(jì)聊天室畢業(yè)論文-資料下載頁(yè)

2025-06-28 08:00本頁(yè)面
  

【正文】 vePort。dispose()。}catch(NumberFormatException e){( 錯(cuò)誤的端口號(hào),端口號(hào)請(qǐng)?zhí)顚?xiě)整數(shù)!)。()。return。}}})。36//關(guān)閉對(duì)話框時(shí)的操作(new WindowAdapter(){public void windowClosing(WindowEvent e){( 默認(rèn)端口號(hào)為:8888)。}})。//取消按鈕的事件處理(new ActionListener(){public void actionPerformed(ActionEvent e){( 默認(rèn)端口號(hào)為:8888)。dispose()。}})。}}import .*。import .*。import .*。import .*。import .*。import .*。/* * 服務(wù)端的偵聽(tīng)類 */public class ServerListen extends Thread {ServerSocket server。JComboBox bobox。JTextArea textarea。JTextField textfield。UserLinkList userLinkList。//用戶鏈表Node client。ServerReceive recvThread。public boolean isStop。/* * 聊天服務(wù)端的用戶上線于下線偵聽(tīng)類 */public ServerListen(ServerSocket server,JComboBox bobox,JTextArea textarea,JTextField textfield,UserLinkList userLinkList){ = server。37 = bobox。 = textarea。 = textfield。 = userLinkList。isStop = false。}public void run(){while(!isStop amp。amp。 !()){try{client = new Node()。 = ()。 = new ObjectOutputStream(())。()。 = new ObjectInputStream(())。 = (String)()。//顯示提示信息()。(client)。(用戶 + + 上線 + \n)。(在線用戶 + () + 人\n)。recvThread = new ServerReceive(textarea,textfield,bobox,client,userLinkList)。()。}catch(Exception e){}}}}import .*。import .*。import .*/* * 服務(wù)器收發(fā)消息的類 */public class ServerReceive extends Thread {JTextArea textarea。JTextField textfield。JComboBox bobox。Node client。UserLinkList userLinkList。//用戶鏈表public boolean isStop。public ServerReceive(JTextArea textarea,JTextField textfield,38JComboBox bobox,Node client,UserLinkList userLinkList){ = textarea。 = textfield。 = client。 = userLinkList。 = bobox。isStop = false。}public void run(){//向所有人發(fā)送用戶的列表sendUserList()。while(!isStop amp。amp。 !()){try{String type = (String)()。if((聊天信息)){String toSomebody = (String)()。String status = (String)()。String action = (String)()。String message = (String)()。String msg = + + action+ 對(duì) + toSomebody + 說(shuō) : + message+ \n。if((悄悄話)){msg = [悄悄話] + msg。}(msg)。if((所有人)){sendToAll(msg)。//向所有人發(fā)送消息}else{try{(聊天信息 )。()。(msg)。()。}catch (Exception e){//(+e)。}39Node node = (toSomebody)。if(node != null){(聊天信息)。 ()。(msg)。()。}}}else if((用戶下線)){Node node = ()。(node)。String msg = 用戶 + + 下線\n。int count = ()。()。(所有人)。int i = 0。while(i count){node = (i)。if(node == null) {i ++。continue。} ()。i++。}(0)。(msg)。(在線用戶 + () + 人\n)。sendToAll(msg)。//向所有人發(fā)送消息sendUserList()。//重新發(fā)送用戶列表,刷新break。}}catch (Exception e){//(e)。}}/* * 向所有人發(fā)送消息 */public void sendToAll(String msg){int count = ()。40int i = 0。while(i count){Node node = (i)。if(node == null) {i ++。continue。}try{(聊天信息)。()。(msg)。()。}catch (Exception e){//(e)。}i++。}}/* * 向所有人發(fā)送用戶的列表 */public void sendUserList(){String userlist = 。int count = ()。int i = 0。while(i count){Node node = (i)。if(node == null) {i ++。continue。}userlist += 。userlist += 39。\n39。i++。}i = 0。while(i count){Node node = (i)。if(node == null) {i ++。continue。} try{41(用戶列表)。()。(userlist)。()。}catch (Exception e){//(e)。}i++。}}}/** * 用戶鏈表 */public class UserLinkList {Node root。Node pointer。int count。/** * 構(gòu)造用戶鏈表 */public UserLinkList(){root = new Node()。 = null。pointer = null。count = 0。}/** * 添加用戶 */public void addUser(Node n){pointer = root。while( != null){pointer = 。} = n。 = null。count++。}/** * 刪除用戶 */42public void delUser(Node n){pointer = root。while( != null){if( == n){ = 。count 。break。}pointer = 。}}/** * 返回用戶數(shù) */public int getCount(){return count。}/** * 根據(jù)用戶名查找用戶 */public Node findUser(String username){if(count == 0) return null。pointer = root。while( != null){pointer = 。if((username)){return pointer。}}return null。}/** * 根據(jù)索引查找用戶 */public Node findUser(int index){if(count == 0) {return null。}if(index 0) {return null。}pointer = root。int i = 0。43while(i index + 1){if( != null){pointer = 。}else{return null。}i++。}return pointer。}}import .*。import .*。import .*。import .*。import .*。import .*。/* * 聊天客戶端的主框架類 */public class ChatClient extends JFrame implements ActionListener{String ip = 。//連接到服務(wù)端的 ip地址int port = 8888。//連接到服務(wù)端的端口號(hào)String userName = 匆匆過(guò)客。//用戶名int type = 0。//0表示未連接,1表示已連接Image icon。//程序圖標(biāo)JComboBox bobox。//選擇發(fā)送消息的接受者JTextArea messageShow。//客戶端的信息顯示JScrollPane messageScrollPane。//信息顯示的滾動(dòng)條JLabel express,sendToLabel,messageLabel 。JTextField clientMessage。//客戶端消息的發(fā)送JCheckBox checkbox。//悄悄話JComboBox actionlist。//表情選擇JButton clientMessageButton。//發(fā)送消息JTextField showStatus。//顯示用戶連接狀態(tài)Socket socket。ObjectOutputStream output。//網(wǎng)絡(luò)套接字輸出流ObjectInputStream input。//網(wǎng)絡(luò)套接字輸入流ClientReceive recvThread。//建立菜單欄JMenuBar jMenuBar = new JMenuBar()。 //建立菜單組JMenu operateMenu = new JMenu (操作(O))。 44//建立菜單項(xiàng)JMenuItem loginItem = new JMenuItem (用戶登錄(I))。JMenuItem logoffItem = new JMenuItem (用戶注銷(L))。JMenuItem exitItem=new JMenuItem (退出(X))。JMenu conMenu=new JMenu (設(shè)置(C))。JMenuItem userItem=new JMenuItem (用戶設(shè)置(U))。JMenuItem connectItem=new JMenuItem (連接設(shè)置(C))。JMenu helpMenu=new JMenu (幫助(H))。JMenuItem helpItem=new JMenuItem (幫助(H))。//建立工具欄JToolBar toolBar = new JToolBar()。//建立工具欄中的按鈕組件JButton loginButton。//用戶登錄JButton logoffButton。//用戶注銷JButton userButton。//用戶信息的設(shè)置JButton connectButton。//連接設(shè)置JButton exitButton。//退出按鈕//框架的大小Dimension faceSize = new Dimension(400, 600)。JPanel downPanel 。GridBagLayout girdBag。GridBagConstraints girdBagCon。public ChatClient(){init()。//初始化程序//添加框架的關(guān)閉事件處理()。()。
點(diǎn)擊復(fù)制文檔內(nèi)容
黨政相關(guān)相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1