服务器之家

服务器之家 > 正文

java制作带界面的聊天工具

时间:2020-11-30 15:21     来源/作者:Java教程网

本文实例为大家分享了java聊天工具的具体制作代码,供大家参考,具体内容如下

首先建立一个工程,导入数据库驱动

工程图

java制作带界面的聊天工具

java制作带界面的聊天工具

解释一下 entity包是 bin目录 message包下 和 user包下 是对象相关的操作

java制作带界面的聊天工具

message

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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;
    }
  }

user

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.fakeqq.entity;
 
import java.util.date;
 
public class user {
 
 
    //这叫实体bin
    private int qqnumber;
    private string qqname;
    private string qqpassword;
    private date registtime; //注册时间
    private string sex;
    private string introduce; //个人简介
    private string ip;
    public int getqqnumber() {
      return qqnumber;
    }
    public void setqqnumber(int qqnumber) {
      this.qqnumber = qqnumber;
    }
    public string getqqname() {
      return qqname;
    }
    public void setqqname(string qqname) {
      this.qqname = qqname;
    }
    public string getqqpassword() {
      return qqpassword;
    }
    public void setqqpassword(string qqpassword) {
      this.qqpassword = qqpassword;
    }
    public date getregisttime() {
      return registtime;
    }
    public void setregisttime(date registtime) {
      this.registtime = registtime;
    }
    public string getsex() {
      return sex;
    }
    public void setsex(string sex) {
      this.sex = sex;
    }
    public string getintroduce() {
      return introduce;
    }
    public void setintroduce(string introduce) {
      this.introduce = introduce;
    }
    public string getip() {
      return ip;
    }
    public void setip(string ip) {
      this.ip = ip;
    }
 
 
 
  }

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。

标签:

相关文章

热门资讯

2020微信伤感网名听哭了 让对方看到心疼的伤感网名大全
2020微信伤感网名听哭了 让对方看到心疼的伤感网名大全 2019-12-26
Intellij idea2020永久破解,亲测可用!!!
Intellij idea2020永久破解,亲测可用!!! 2020-07-29
歪歪漫画vip账号共享2020_yy漫画免费账号密码共享
歪歪漫画vip账号共享2020_yy漫画免费账号密码共享 2020-04-07
电视剧《琉璃》全集在线观看 琉璃美人煞1-59集免费观看地址
电视剧《琉璃》全集在线观看 琉璃美人煞1-59集免费观看地址 2020-08-12
最新idea2020注册码永久激活(激活到2100年)
最新idea2020注册码永久激活(激活到2100年) 2020-07-29
返回顶部