Q趣聊天通信软件应用设计
2017-07-06 15:33
162 查看
前言
防制的QQ聊天登录以及聊天功能,可以实现基本的注册账号,记住密码,密码找回,自动登录,注销等功能,多客户端实现无障碍聊天,传输文件,互不影响,使用简单方便。
Q趣聊天——客户端开发
话不多说,上图,界面是使用swing编写的,有点小丑,嘿嘿,可以导入一些包来修饰组件的,后期有时间就继续拓展。
聊天功能涉及到信息的传递,有关于socket网络编程,可以找些教材来看看,补一下这方面的基础。这里主要涉及到客户端跟服务器端两个方面的问题,在这里,我先讲的是客户端,从自己预定义功能出发,从界面表现层出发,然后业务逻辑层,最后DAO数据处理层。
开发——界面开发
给页面添加监听器,红色圈出了几个事件源,由点击它们出发事件,来跳到新页面或者执行查询,反馈提醒等功能。
- 登录
注册
记住密码
找回密码
源码下载地址:
http://download.csdn.net/download/u011958281/9930368
防制的QQ聊天登录以及聊天功能,可以实现基本的注册账号,记住密码,密码找回,自动登录,注销等功能,多客户端实现无障碍聊天,传输文件,互不影响,使用简单方便。
Q趣聊天——客户端开发
话不多说,上图,界面是使用swing编写的,有点小丑,嘿嘿,可以导入一些包来修饰组件的,后期有时间就继续拓展。
聊天功能涉及到信息的传递,有关于socket网络编程,可以找些教材来看看,补一下这方面的基础。这里主要涉及到客户端跟服务器端两个方面的问题,在这里,我先讲的是客户端,从自己预定义功能出发,从界面表现层出发,然后业务逻辑层,最后DAO数据处理层。
开发——界面开发
给页面添加监听器,红色圈出了几个事件源,由点击它们出发事件,来跳到新页面或者执行查询,反馈提醒等功能。
- 登录
// 监听登陆按钮 loginButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String u_name = u_nameField.getText(); // textField.getText(); if (file.length() != 0) { if (userPro.containsKey(u_name)) { String u_pwd = new String(passwordField.getPassword()); if (u_pwd.equals(userPro.getProperty(u_name))) { try { Socket client = new Socket("localhost", 8520); loginButton.setEnabled(false); // clientLists frame = new clientLists(u_name, client); CatChatroom frame = new CatChatroom(u_name, client); frame.setVisible(true);// 显示聊天界面 setVisible(false);// 隐藏掉登陆界面 } catch (UnknownHostException e1) { // TODO Auto-generated catch block errorTip("The connection with the server is interrupted, please login again"); } catch (IOException e1) { // TODO Auto-generated catch block errorTip("The connection with the server is interrupted, please login again"); } } else { lblNewLabel_2.setText("*您输入的密码有误!"); passwordField.requestFocus(); } } else { lblNewLabel_3.setText("*您输入昵称不存在!"); u_nameField.setText(""); passwordField.setText(""); u_nameField.requestFocus(); } } else { lblNewLabel_3.setText("*请您输入昵称!"); u_nameField.setText(""); passwordField.setText(""); u_nameField.requestFocus(); } } });
注册
// 注册按钮监听 lblNewLabel.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { reginFrame frame = new reginFrame(); frame.setVisible(true);// 显示注册界面 }
记住密码
//记住密码监视器 class CheckListen implements ItemListener { public void itemStateChanged(ItemEvent envent) { Properties userPro = new Properties(); File file = new File("Users.properties"); CatUtil.loadPro(userPro, file); if (chckbxNewCheckBox.isSelected()) { String u_name = u_nameField.getText(); // passwordField.setText(userPro.getProperty(u_name)); userPro.setProperty("flag", "1"); } else { userPro.setProperty("flag", "0"); } try { userPro.store(new FileOutputStream(file), "Infor 4000 mation of regin"); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
找回密码
// 找回密码按钮监听 lblNewLabel_1.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { // lblNewLabel_1.setEnabled(false); findPassword frame = new findPassword(); frame.setVisible(true);// 显示注册界面 // setVisible(false);// 隐藏掉登陆界面 }
源码下载地址:
http://download.csdn.net/download/u011958281/9930368
相关文章推荐
- 前端通信:SSE设计方案(二)--- 服务器推送技术的实践以及一些应用场景的demo(包括在线及时聊天系统以及线上缓存更新,代码热修复案例)
- 初探基于TCP的服务器/客户端结构的聊天系统(二)之应用层通信协议设计
- 架构设计:系统间通信(2)——概述从“聊天”开始下篇
- 通过学习学生信息管理系统软件,C程序中,如何设计和编写一个应用系统
- 软件架构和软件框架-用例模型设计应用(1)
- 思考设计模式在自助终端软件上的应用 ——Observer(观察着)模式
- 架构设计:系统间通信(1)——概述从“聊天”开始上篇
- 论设计模式在软件开发中的应用
- Android应用实现点击back键时,使应用返回桌面,而不是退出应用,类似微信,qq等聊天软件
- 浅谈企业应用软件架构设计过程
- NET 应用架构指导 V2 学习笔记(六) 软件架构和设计方法
- 通过学习学生信息管理系统软件,C程序中,如何设计和编写一个应用系统?
- 两单片机通过 SPI 通信的软件协议设计概述
- “亿迅杯”应用软件设计大赛通知
- Unity应用架构设计(2)——使用中介者模式解耦ViewModel之间通信
- android使用Socket通信实现多人聊天应用
- [我的软考作文]论基于DSSA的软件架构设计与应用
- 搜应用网是中国最丰富的手机资源下载站,为你提供精彩的手机图片.手机应用软件.手机游戏,定制服务手机用户的个性化需求,是广大手机用户.手机开发者.手机软件界面设计人员的广阔乐园.
- 应用软件开发过程中设计需求分析的一点体会
- 架构设计:系统间通信(1)——概述从“聊天”开始上篇