欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

java制作带界面的聊天工具

程序员文章站 2023-11-17 10:16:58
本文实例为大家分享了java聊天工具的具*作代码,供大家参考,具体内容如下 首先建立一个工程,导入数据库驱动 工程图 解释一下 entity包是 bin...

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

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

工程图

java制作带界面的聊天工具

java制作带界面的聊天工具

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

java制作带界面的聊天工具

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;
    }
  }

user

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;
    }



  }


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