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

正文內(nèi)容

java課程設(shè)計(jì)之簡(jiǎn)單聊天室(參考版)

2025-07-02 07:28本頁(yè)面
  

【正文】 if(()){ status = 悄悄話。//標(biāo)志位設(shè)為未連接 } catch (Exception e){ // } } public void SendMessage(){ String toSomebody = ().toString()。 (已經(jīng)與服務(wù)器斷開(kāi)連接...\n)。 ()。 ()。 if(()){ return 。 (false)。 (true)。 (true)。 (true)。 return。 type = 1。 (true)。 (true)。 (false)。 (false)。 (false)。 recvThread = new ClientReceive(socket,output,input,bobox,messageShow,showStatus)。 (userName)。 ()。 return。\n請(qǐng)確認(rèn)連接設(shè)置是否正確。 } } public void Connect(){ try{ socket = new Socket(ip,port)。 } } else if (obj == helpItem) { //菜單欄中的幫助 //調(diào)出幫助對(duì)話框 Help helpDialog = new Help(this)。 if (j == ){ if(type == 1){ DisConnect()。 ()。 ()。 } else if (obj == loginItem || obj == loginButton) { //登錄 Connect()。 ip = 。 } else if (obj == connectItem || obj == connectButton) { //連接服務(wù)端設(shè)置 //調(diào)出連接設(shè)置對(duì)話框 ConnectConf conConf = new ConnectConf(this,ip,port)。 (true)。 } /** * 事件處理 */ public void actionPerformed(ActionEvent e) { Object obj = ()。 } (0)。 (downPanel,)。 (showStatus)。 = 5。 = 0。 (false)。 (clientMessageButton)。 = 3。 girdBagCon = new GridBagConstraints()。 (clientMessage,girdBagCon)。 = 3。 = 1。 (messageLabel)。 = 3。 girdBagCon = new GridBagConstraints()。 (checkbox,girdBagCon)。 // = 5。 = 2。 girdBagCon = new GridBagConstraints()。 (actionlist,girdBagCon)。 // = 5。 = 。 = 3。 (express)。 = 。 =2。 (bobox)。 = 。 =1。 (sendToLabel)。 // = 5。 = new Insets(1,0,0,0)。 = 0。 (none)。 JLabel none = new JLabel( )。 = 5。 = 5。 = 0。 (girdBag)。 downPanel = new JPanel()。 express = new JLabel( 表情: )。 (this)。 (發(fā)送)。 (false)。 ()。 //添加滾動(dòng)條 messageScrollPane = new JScrollPane(messageShow, , )。 messageShow = new JTextArea()。 (所有人,0)。 (this)。 (this)。 //添加按鈕的事件偵聽(tīng) (this)。 (this)。 (this)。 //為菜單欄添加事件監(jiān)聽(tīng) (this)。 //初始時(shí) (true)。 (靜靜地)。 (生氣地)。 (高興地)。 actionlist = new JComboBox()。 checkbox = new JCheckBox(悄悄話)。//添加分隔欄 (exitButton)。 (logoffButton)。 ()。 //將按鈕添加到工具欄 (userButton)。 (設(shè)置用戶信息)。 //當(dāng)鼠標(biāo)放上顯示信息 (連接到指定的服務(wù)器)。 connectButton = new JButton(連接設(shè)置 )。 logoffButton = new JButton(注銷)。 setJMenuBar (jMenuBar)。 (helpItem)。 (connectItem)。 (operateMenu)。 (logoffItem)。 (new BorderLayout())。 ( (,))。H39。)。 (39。 //為幫助菜單欄設(shè)置熱鍵39。)。 //為連接設(shè)置設(shè)置快捷鍵為ctrl+c (39。)。 //為用戶設(shè)置設(shè)置快捷鍵為ctrl+u (39。C39。C39。 ( (,))。X39。 ( (,))。L39。 ( (,))。I39。)。 (39。 //為操作菜單欄設(shè)置熱鍵39。 (聊天室客戶端)。 ( (int) ( ()) / 2, (int) ( ()) / 2)。 //設(shè)置框架的大小 (faceSize)。//初始化程序 //添加框架的關(guān)閉事件處理 ()。 GridBagConstraints girdBagCon。 JPanel downPanel 。//連接設(shè)置 JButton exitButton。//用戶注銷 JButton userButton。 //建立工具欄中的按鈕組件 JButton loginButton。 JMenuItem helpItem=new JMenuItem (幫助(H))。 JMenuItem connectItem=new JMenuItem (連接設(shè)置(C))。 JMenu conMenu=new JMenu (設(shè)置(C))。 JMenuItem logoffItem = new JMenuItem (用戶注銷(L))。 //建立菜單組 JMenu operateMenu = new JMenu (操作(O))。//網(wǎng)絡(luò)套接字輸入流 ClientReceive recvThread。 ObjectOutputStream output。//發(fā)送消息 JTextField showStatus。//悄悄話 JComboBox actionlist。 JTextField clientMessage。//客戶端的信息顯示 JScrollPane messageScrollPane。//0表示未連接,1表示已連接 JComboBox bobox。//連接到服務(wù)端的端口號(hào) String userName = 匆匆過(guò)客。 String ip = 。import .*。import .*。import .*。當(dāng)?shù)顷懙街付ǖ姆?wù)器時(shí),調(diào)用ClientReceive類實(shí)現(xiàn)消息收發(fā),同時(shí)該類還定義了SendMessaga()方法來(lái)其他用戶發(fā)送帶有表情的消息或悄悄話。 }}ChatClient類功能:定義客戶端的界面,添加時(shí)間監(jiān)聽(tīng)與事件處理。 //事件處理 ( new ActionListener() { public void actionPerformed(ActionEvent e) { dispose()。 (closePanel, )。 (titlePanel, )。 Container contentPane = getContentPane()。 (close)。 (help)。 (title)。 (false)。\n+ 信息狀態(tài)欄中顯示服務(wù)器當(dāng)前的啟動(dòng)與停止?fàn)顟B(tài)、+ 用戶發(fā)送的消息和\n 服務(wù)器端發(fā)送的系統(tǒng)消息。\n+ 點(diǎn)擊 啟動(dòng)服務(wù) 按鈕便可在指定的端口啟動(dòng)服務(wù)。 (bg)。 (bg)。 } private void jbInit() throws Exception { (new Dimension(400, 200))。 ( (int) ( 400) / 2, (int) ( 320) / 2)。 } catch (Exception e) { ()。 public Help(JFrame frame) { super(frame, true)。 JTextArea help = new JTextArea()。 JButton close = new JButton()。 JPanel contentPanel = new JPanel()。/** * 生成設(shè)置對(duì)話框的類 */public class Help extends JDialog { /** * */ private static final long serialVersionUID = 1L。import .*。代碼:package server。 } } )。 //取消按鈕的事件處理 ( new ActionListener(){ public void actionPerformed(ActionEvent e){ ( 默認(rèn)端口號(hào)為:8888)。 //關(guān)閉對(duì)話框時(shí)的操作 ( new WindowAdapter(){ public void windowClosing(WindowEvent e){ ( 默認(rèn)端口號(hào)為:8888)。 return。 } catch(NumberFormatException e){ ( 錯(cuò)誤的端口號(hào),端口號(hào)請(qǐng)?zhí)顚?xiě)整數(shù)!)。 } = savePort。 ()。 try{ savePort=(())。 (panelSave, )。 (panelPort, )。 Container contentPane = getContentPane()。 (cancel)。 (new Label( ))。 (message)。 (取消)。 (+)。 (請(qǐng)輸入偵聽(tīng)的端口號(hào):)。 } private void jbInit() throws Exception { (new Dimension(300, 120))。 ( (int) ( 400) / 2 + 50, (int) ( 600) / 2 + 150)。 } catch (Exception e) { ()。 public PortConf(JFrame frame) { super(frame, true)。 JLabel message = new JLabel()。 public static JLabel DLGINFO=new JLabel( 默認(rèn)端口號(hào)為:8888)。 JButton save = new JButton()。/** * 生成端口設(shè)置對(duì)話框的類 */public class PortConf extends JDialog { /** * */ private static final long serialVersionUID = 1L。import .*。代碼:package server。 Node next = null。 ObjectOutputStream output = null。/** * 用戶鏈表的結(jié)點(diǎn)類 */public class Node { String username = null。
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評(píng)公示相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1