




如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
源代码 项目QQClientProject: LoguiGui代码: packagecom.huaxia.qq.mzz.gui; importcom.huaxia.qq.mzz.common.Message; importcom.huaxia.qq.mzz.common.MessageService; importcom.huaxia.qq.mzz.common.User; importjava.net.Socket; importjavax.swing.JOptionPane; publicclassLoguiGuiextendsjavax.swing.JFrame{ publicLoguiGui(){ initComponents(); } publicSocketconnectServer(){ Sockets=null; try{ s=newSocket("127.0.0.1",6666); }catch(Exceptione){ e.printStackTrace(); } returns; } privatevoidjButton1ActionPerformed(java.awt.event.ActionEventevt){ //TODOaddyourhandlingcodehere: Stringname=nameItem.getText(); System.out.println("用户名:"+name); if(name==null||"".equals(name)){ JOptionPane.showMessageDialog(this,"用户名不能为空,请输入","异常提示",JOptionPane.ERROR_MESSAGE); return; } Stringpwd=newString(pwdItem.getPassword()); System.out.println("密码:"+pwd); if(pwd.length()==0){ JOptionPane.showMessageDialog(this,"密码不能为空,请输入","异常提示",JOptionPane.ERROR_MESSAGE); return; } finalSockets=this.connectServer(); //构造消息 finalUseru=newUser(name,pwd); Messagemsg=newMessage(1,u); //执行发送 MessageService.getInstance().sendMsg(msg,s); //接受消息【接收注册结果】 Messageresult=MessageService.getInstance().receiveMsg(s); //取出注册成功的标志 Stringr=(String)result.getBody(); if(r==null){//注册成功 java.awt.EventQueue.invokeLater(newRunnable(){ publicvoidrun(){ newChatGui(u,s).setVisible(true); } }); this.dispose(); }else{ JOptionPane.showMessageDialog(this,"登录失败:"+r,"异常提示",JOptionPane.INFORMATION_MESSAGE); } privatevoidjLabel3MouseClicked(java.awt.event.MouseEventevt){ //TODOaddyourhandlingcodehere: finalLoguiGuigui=this; java.awt.EventQueue.invokeLater(newRunnable(){ publicvoidrun(){ RegiterGuidialog=newRegiterGui(gui,true); dialog.setLocationRelativeTo(gui); dialog.setVisible(true); } }); } privatevoidjButton2MouseClicked(java.awt.event.MouseEventevt){ //TODOaddyourhandlingcodehere: nameItem.setText(null); pwdItem.setText(null); } publicstaticvoidmain(Stringargs[]){ java.awt.EventQueue.invokeLater(newRunnable(){ publicvoidrun(){ newLogui

王子****青蛙
实名认证
内容提供者


最近下载
最新上传
浙江省宁波市2024-2025学年高三下学期4月高考模拟考试语文试题及参考答案.docx
汤成难《漂浮于万有引力中的房屋》阅读答案.docx
四川省达州市普通高中2025届第二次诊断性检测语文试卷及参考答案.docx
山西省吕梁市2025年高三下学期第二次模拟考试语文试题及参考答案.docx
山西省部分学校2024-2025学年高二下学期3月月考语文试题及参考答案.docx
山西省2025年届高考考前适应性测试(冲刺卷)语文试卷及参考答案.docx
全国各地市语文中考真题名著阅读分类汇编.docx
七年级历史下册易混易错84条.docx
湖北省2024-2025学年高一下学期4月期中联考语文试题及参考答案.docx
黑龙江省大庆市2025届高三第三次教学质量检测语文试卷及参考答案.docx