新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
本文实例为大家分享了java聊天工具的具体制作代码,供大家参考,具体内容如下
创新互联建站坚持“要么做到,要么别承诺”的工作理念,服务领域包括:网站建设、网站制作、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的永春网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!首先建立一个工程,导入数据库驱动
工程图
解释一下 entity包是 bin目录 Message包下 和 User包下 是对象相关的操作
Message
package com.FakeQQ.entity; import java.util.Date; public class Message { //需要序列化发送,所以要继承Serializable接口 private int id; private String content; private int sender; private int receiver; private Date sendTime; private Date receiveTime; private int state; private int ip; public int getIp() { return ip; } public void setIp(int ip) { this.ip = ip; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public int getSender() { return sender; } public void setSender(int sender) { this.sender = sender; } public int getReceiver() { return receiver; } public void setReceiver(int receiver) { this.receiver = receiver; } public Date getSendTime() { return sendTime; } public void setSendTime(Date sendTime) { this.sendTime = sendTime; } public Date getReceiveTime() { return receiveTime; } public void setReceiveTime(Date receiveTime) { this.receiveTime = receiveTime; } public int getState() { return state; } public void setState(int state) { this.state = state; } }