毕业设计 - 基于Java的即时通讯软件的设计与实现【源码+论文】

293 篇文章 9 订阅
266 篇文章 18 订阅


前言

今天学长向大家分享一个 java 设计项目:

基于Java的即时通讯软件的设计与实现


一、项目设计

1. 模块设计

在这里插入图片描述
该即时通讯系统是有两部分组成,

服务器端可以通过启动来监听客户端信息的传递与执行各种对客户端的监控,客户端则是通过人性化与美观的界面来使用户可以易上手和舒适的体验快速与简便的通讯。

应用从这两部分分别进行了详细的功能设计,服务器端功能主要为启动对于客户端的监听与关闭监听,还有对于已注册用户的实时监控与管理,客户端功能主要为使用者该软件账号的申请与进入操作界面,还有自己资料的修改以及对于其他账号好友的添加与管理等等。

2. 实现效果

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

二、部分源码

部分代码示例:

package cn.itbaizhan.client;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream;
import java.io.RandomAccessFile;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

import cn.itbaizhan.common.*;

public class ChangeHead extends JDialog {
	 BufferedReader in;//����������
	 PrintStream out;//���������
	 UserBean myInfo;
	 JLabel jLtop=new JLabel(new ImageIcon("src/file/changeHeadtop.jpg"));//530*25
	 JButton jB1=new JButton(new ImageIcon("src/file/changeHead1.jpg"));//75*20�Զ���ͷ��
	 JPanel jP=new JPanel();//��ʾϵͳͷ��ģ��
	 //JScrollPane js=new JScrollPane(jP);
	 JButton jB2=new JButton(new ImageIcon("src/file/changeHead2.jpg"));//65*20ϵͳͷ��
	 JButton jB3=new JButton(new ImageIcon("src/file/changeHead3.jpg"));//90*20��Աͷ��
	 JButton jB4=new JButton(new ImageIcon("src/file/changeHead4.jpg"));//70*20��Աͷ��
	 JLabel jLtop2=new JLabel(new ImageIcon("src/file/changeHeadtop2.jpg"));//140*20
	 JLabel jLshow=new JLabel("�Ƽ�ͷ��");
	 JLabel jLprepare=new JLabel("Ԥ��");
	 JButton jBsure=new JButton(new ImageIcon("src/file/changeHeadSure.jpg"));//65*20
	 JLabel por=new JLabel(new ImageIcon("src/file/personelView1.jpg"));
	 String imagePath="src/head/10-1.gif";//�û�ѡ���ͼ���·��
	 PersonelView father;
	public ChangeHead(JFrame owner, String title, boolean b,
			UserBean myInfo, BufferedReader in, PrintStream out,PersonelView father) {
		// TODO Auto-generated constructor stub
		super(owner,title,b);
		this.in=in;
		this.out=out;
		this.myInfo=myInfo;
		this.father=father;
		this.setSize(530, 403);
		this.setLocationRelativeTo(null);
		this.setLayout(null);
		init();
		this.add(jLtop);
		this.add(jB1);
		this.add(jB2);
		this.add(jB3);
		this.add(jB4);
		this.add(jLtop2);
		this.add(jP);
		this.add(jLshow);
		this.add(jLprepare);
		this.add(por);
		this.add(jBsure);
		this.setVisible(true);
	}
	 public void init()
	 {
		 jLtop.setBounds(0, 0, 530, 25);
		 jB1.setBounds(0, 25, 75, 20);
		 jB2.setBounds(75, 25, 65, 20);
		 jP.setBounds(0, 70, 400, 500);
		 jP.setBackground(Color.WHITE);
		 jP.setLayout(new FlowLayout());
		 makeIcon();
		 jB3.setBounds(140, 25, 90, 20);
		 jB4.setBounds(230, 25, 70, 20);
		 jLtop2.setBounds(300, 25, 100, 20);
		 jLshow.setFont(new Font("����",Font.PLAIN,14));
		 jLshow.setForeground(Color.BLACK);
		 jLshow.setBounds(10,45, 400, 25);
		 jLshow.setBackground(Color.WHITE);
		 
		 jLprepare.setFont(new Font("����",Font.PLAIN,16));
		 jLprepare.setForeground(Color.BLACK);
		 jLprepare.setBounds(410,30, 100, 25);
		 jLprepare.setBackground(Color.WHITE);
		
		 por.setIcon(new ImageIcon(myInfo.getPortrait()));
		 por.setBounds(420, 60, 60, 60);
		 jBsure.setBounds(420, 335, 65, 20);
		 jBsure.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent arg0) {
				// TODO Auto-generated method stub
				String image=por.getIcon().toString();
				out.println("UpdateMyportrait");
				out.flush();
				out.println(myInfo.getUserNum());
				out.flush();
				out.println(image);
				out.flush();
				try {
					String judge=in.readLine();
					if(judge.equals("updateMyportraitOver"))
					{
						ChangeHead.this.setVisible(false);
						//JOptionPane.showMessageDialog(father, "����ͷ��ɹ���");
						System.out.println("����ͷ��ɹ���");
					}
					else if(judge.equals("updateMyportraitFail"))
					{
						ChangeHead.this.setVisible(false);
						JOptionPane.showMessageDialog(father, "����ͷ��ɹ���");
						System.out.println("ϵͳ��æ�����Ժ����ԣ�");
					}
				} catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
			}
			 
		 });
	
	 }
	 private void makeIcon()
	 {
		 String path="src/head/";
		 try {
			RandomAccessFile file=new RandomAccessFile(path+"face.txt","r");
			long fileLongth=file.length();
			System.out.println(fileLongth);
			long filePointer=0;
			JLabel[] jLimage=new JLabel[84];
			int i=0;
			while(filePointer<fileLongth)
			{
				jLimage[i]=new JLabel(new ImageIcon(new String(path+file.readLine())));
				jLimage[i].addMouseListener(new MouseAdapter(){
					public void mousePressed(MouseEvent e)
					{
						String iconInfo=e.toString();
						int begin=iconInfo.indexOf("src/head");
						int last=iconInfo.lastIndexOf("-1.gif");
						imagePath=iconInfo.substring(begin, last+6);
						por.setIcon(new ImageIcon(imagePath));
						System.out.println(imagePath);
					}
				});
				jP.add(jLimage[i]);
				i++;
				filePointer=file.getFilePointer();
			}
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	 }
}

项目源码

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
聊天系统采用客户机/服务器(C/S)地模式来设计,是一个3层地C/S结构:数据库服务器→应用程序服务器端→应用程序客户端,其分层结构如下图所示。系统采用C/S结构,可以将任务合理分配到客户机端和服务器端,从而降低了系统的通讯开销。 1. 客户层 客户层也叫应用表示层,是应用程序地客户接口部分。给聊天工具设计一个客户层具用很多优点,这是因为客户层担负着用户与应用间地对话功能。它用于检查用户的输入数据,显示应用的输出数据。为了使用户能直观的进行操作,客户层需要使用接口。若聊天用户变更,系统只需改写显示控制和数据检查程序即可,而不影响其他两层。数据检查的内容限于数据的形式和值得范围,不包括有关业务的处理逻辑。 2. 服务层 服务层又叫功能层,相当于应用的本体,他是讲具体的业务出路逻辑编入程序中。例如,用户需要检索数据,系统没法将有关检索要求的信息一次性的传送给功能层:而用户登陆后,聊天登录信息是由功能层处理过的检索结果数据,他也是一次性传送给表示层的。在应用设计中,不许避免在表示层和功能层之间进行多次的数据交换,这就需要尽可能进行一次性的业务处理,达到优化整体设计的目的。 3. 数据层 数据层就是DBMS,本聊天工具使用了Microsoft公司的SQL Server2000能迅速执行大量的更新和检索,因此,从功能层传送到数据层的“要求”一般都使用SQL语言。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值