电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

java聊天工具源代码

java聊天工具源代码_第1页
1/22
java聊天工具源代码_第2页
2/22
java聊天工具源代码_第3页
3/22
源代码 项目QQClientProject: LoguiGui 代码: package com.huaxia.qq.mzz.gui; import com.huaxia.qq.mzz.common.Message; import com.huaxia.qq.mzz.common.MessageService; import com.huaxia.qq.mzz.common.User; import java.net.Socket; import javax.swing.JOptionPane; public class LoguiGui extends javax.swing.JFrame { public LoguiGui() { initComponents(); } public Socket connectServer() { Socket s = null; try { s = new Socket("127.0.0.1", 6666); } catch (Exception e) { e.printStackTrace(); } return s; } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: String name = nameItem.getText(); System.out.println("用户名:" + name); if (name == null || "".equals(name)) { JOptionPane.showMessageDialog(this, " 用户名不 能 为 空 , 请 输 入 ", " 异 常 提 示 ", JOptionPane.ERROR_MESSAGE); return; } String pwd = new String(pwdItem.getPassword()); System.out.println("密码:" + pwd); if (pwd.length() == 0) { JOptionPane.showMessageDialog(this, " 密 码不 能 为 空 , 请 输 入 ", " 异 常 提 示 ", JOptionPane.ERROR_MESSAGE); return; } final Socket s = this.connectServer(); //构造消息 final User u = new User(name, pwd); Message msg = new Message(1, u); //执行发送 MessageService.getInstance().sendMsg(msg, s); //接受消息【接收注册结果】 Message result = MessageService.getInstance().receiveMsg(s); // 取出注册成功的标志 String r = (String) result.getBody(); if (r == null) {//注册成功 java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new ChatGui(u, s).setVisible(true); } }); this.dispose(); } else { JOptionPane.showMessageDialog(this, " 登 录 失 败 :" + r, " 异 常 提 示 ", JOptionPane.INFORMATION_MESSAGE); } private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: final...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

java聊天工具源代码

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部