javaSwing酒店管理

一、介绍

在这篇博客中,我们将介绍一个基于MySQL数据库、Java编程语言和Swing图形用户界面的简单酒店管理系统。该系统包括了查询房客信息、查询房客状态、修改房客信息、添加房间信息、添加住户、退房管理、预定管理、退订管理、入账管理、出账管理、修改资料等多个功能。

二、数据库介绍

1.t_book(预订信息表):

表示酒店客房的预订信息,每条记录对应一个预订订单。
字段解释:
id: 预订编号,主键。
name: 预订人姓名。
phone: 预订人电话。
checkTime: 预订入住时间。
creditTime: 订单创建时间。
state: 预订状态(已退订等)。
t_cashier(收支信息表):

记录酒店的收入和支出情况,用于财务管理。
字段解释:
id: 记录编号,主键。
type: 类型(收入/支出)。
money: 金额。
remarks: 备注。
time: 创建时间。

2.t_guestroom(客房信息表):

存储酒店客房的基本信息,包括房间号、状态和类型。
字段解释:
id: 客房编号,主键。
num: 房间号。
state: 房间状态(0表示空闲,1表示已入住)。
type: 客房类型。

3.t_household(住户信息表):

记录入住和退房的住户信息,包括姓名、身份证号、入住时间、房间号等。
字段解释:
id: 住户编号,主键。
name: 住户姓名。
idNum: 身份证号码。
checkTime: 入住时间。
roomNum: 入住房号。
money: 收费金额。
state: 入住状态。
outTime: 退房时间。

4.t_user(用户信息表):

存储系统用户的登录名和密码。
字段解释:
id: 用户编号,主键。
userName: 登录名。
password: 登录密码。

三、程序截图

1.查询房客信息

在这里插入图片描述

2.查询房客状态

在这里插入图片描述

3.修改客房信息

在这里插入图片描述

4.添加房间信息

在这里插入图片描述

5.添加住户

在这里插入图片描述

6.退房管理

在这里插入图片描述

7.预定管理

在这里插入图片描述

8.退订管理

在这里插入图片描述

9.入账管理

在这里插入图片描述

10.出账管理

在这里插入图片描述

11.修改资料

在这里插入图片描述

四、代码

1.addGuestRoom

/** addGuestRoom.java** Created on __DATE__, __TIME__*/package hotel.view;import java.awt.event.ActionEvent;
import java.sql.Connection;import hotel.dao.KeFangDao;
import hotel.model.KeFang;
import hotel.util.DbUtil;import javax.swing.JOptionPane;/**** @author  __USER__*/
public class addGuestRoom extends javax.swing.JInternalFrame {DbUtil dbUtil = new DbUtil();KeFangDao guestRoomDao = new KeFangDao();/** Creates new form addGuestRoom */public addGuestRoom() {initComponents();}//GEN-BEGIN:initComponents
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {jLabel1 = new javax.swing.JLabel();
num = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
type = new javax.swing.JTextField();
save = new javax.swing.JButton();
reset = new javax.swing.JButton();setClosable(true);
setTitle("添加房间信息");jLabel1.setText("房间号");num.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
numActionPerformed(evt);
}
});jLabel2.setText("类型");save.setText("保存");
save.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveActionPerformed(evt);
}
});reset.setText("重置");
reset.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
resetActionPerformed(evt);
}
});org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(45, 45, 45)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(jLabel1)
.add(jLabel2))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(type)
.add(num, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)))
.add(layout.createSequentialGroup()
.add(84, 84, 84)
.add(save)
.add(18, 18, 18)
.add(reset)))
.addContainerGap(88, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(38, 38, 38)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel1)
.add(num, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel2)
.add(type, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 17, Short.MAX_VALUE)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(reset)
.add(save))
.addContainerGap())
);pack();
}	/*** 重置按钮时间* @param evt*/private void resetActionPerformed(ActionEvent evt) {reset();}private void saveActionPerformed(java.awt.event.ActionEvent evt) {String num = this.num.getText();String type = this.type.getText();if(num == null || "".equals(num)){JOptionPane.showMessageDialog(null, "请输入房间号");return;}if(type == null && "".equals(type)){JOptionPane.showMessageDialog(null, "请输入类型");return;}Connection con = null;try {con = dbUtil.getCon();KeFang g = guestRoomDao.findByRoomNum(con, Integer.parseInt(num));//判断房间号是否存在if(g != null){JOptionPane.showMessageDialog(null, "该房间已存在");return;}//封装对象KeFang guestRoom = new KeFang();guestRoom.setNum(Integer.parseInt(num));guestRoom.setState(0);guestRoom.setType(type);//保存数据int result = guestRoomDao.addGusteRoom(con, guestRoom);if(result != 0){JOptionPane.showMessageDialog(null, "添加成功");}else{JOptionPane.showMessageDialog(null, "添加失败");}} catch (Exception e) {JOptionPane.showMessageDialog(null, "添加失败");e.printStackTrace();}finally{try {dbUtil.closeCon(con);//关闭数据库连接} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}}}/*** 清空输入框的值*/private void reset(){this.num.setText("");this.type.setText("");}void numActionPerformed(java.awt.event.ActionEvent evt) {// TODO add your handling code here:}//GEN-BEGIN:variables
// Variables declaration - do not modify
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JTextField num;
private javax.swing.JButton reset;
private javax.swing.JButton save;
private javax.swing.JTextField type;
// End of variables declaration//GEN-END:variables}

2.addHousehold

/** addHousehold.java** Created on __DATE__, __TIME__*/package hotel.view;import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;import hotel.dao.ShouYinDao;
import hotel.dao.KeFangDao;
import hotel.dao.RuZhuDao;
import hotel.model.ShouYin;
import hotel.model.KeFang;
import hotel.model.ZhuHu;
import hotel.util.DbUtil;import javax.swing.JButton;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;import org.jdesktop.layout.GroupLayout;
import org.jdesktop.layout.LayoutStyle;/**** 添加住户窗口*/
public class addHousehold extends JInternalFrame {//实例化对象DbUtil dbUtil = new DbUtil();RuZhuDao householdDao = new RuZhuDao();KeFangDao guestRoomDao = new KeFangDao();ShouYinDao cashierDao = new ShouYinDao();//创建窗口public addHousehold() {initComponents();this.setLocation(200, 50);}//控件private void initComponents() {jLabel1 = new JLabel();jLabel2 = new JLabel();jLabel3 = new JLabel();jLabel4 = new JLabel();name = new JTextField();idNum = new JTextField();money = new JTextField();roomNum = new JTextField();jButton1 = new JButton();jButton2 = new JButton();setClosable(true);setIconifiable(true);setMaximizable(true);setTitle("添加住户");jLabel1.setText("姓名");jLabel2.setText("身份证");jLabel3.setText("房间号");jLabel4.setText("收费");jButton1.setText("添加");jButton1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent evt) {jButton1ActionPerformed(evt);}});jButton2.setText("重置");/*** layout布局*/GroupLayout layout = new GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.LEADING).add(layout.createSequentialGroup().addContainerGap(56, Short.MAX_VALUE).add(layout.createParallelGroup(GroupLayout.LEADING).add(GroupLayout.TRAILING,layout.createSequentialGroup().add(jButton1).add(51,51,51).add(jButton2).add(119,119,119)).add(GroupLayout.TRAILING,layout.createSequentialGroup().add(layout.createParallelGroup(GroupLayout.TRAILING).add(jLabel3).add(jLabel4).add(jLabel2).add(jLabel1)).add(50,50,50).add(layout.createParallelGroup(GroupLayout.LEADING).add(layout.createParallelGroup(GroupLayout.TRAILING,false).add(GroupLayout.LEADING,idNum).add(GroupLayout.LEADING,name,GroupLayout.DEFAULT_SIZE,195,Short.MAX_VALUE)).add(layout.createParallelGroup(GroupLayout.TRAILING,false).add(GroupLayout.LEADING,money).add(GroupLayout.LEADING,roomNum,GroupLayout.DEFAULT_SIZE,193,Short.MAX_VALUE))).add(89,89,89)))));layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.LEADING).add(layout.createSequentialGroup().add(39, 39, 39).add(layout.createParallelGroup(GroupLayout.BASELINE).add(jLabel1).add(name,GroupLayout.PREFERRED_SIZE,GroupLayout.DEFAULT_SIZE,GroupLayout.PREFERRED_SIZE)).addPreferredGap(LayoutStyle.RELATED).add(layout.createParallelGroup(GroupLayout.BASELINE).add(jLabel2).add(idNum,GroupLayout.PREFERRED_SIZE,GroupLayout.DEFAULT_SIZE,GroupLayout.PREFERRED_SIZE)).addPreferredGap(LayoutStyle.RELATED).add(layout.createParallelGroup(GroupLayout.BASELINE).add(jLabel3).add(roomNum,GroupLayout.PREFERRED_SIZE,GroupLayout.DEFAULT_SIZE,GroupLayout.PREFERRED_SIZE)).add(4, 4, 4).add(layout.createParallelGroup(GroupLayout.BASELINE).add(jLabel4).add(money,GroupLayout.PREFERRED_SIZE,GroupLayout.DEFAULT_SIZE,GroupLayout.PREFERRED_SIZE)).add(18, 18, 18).add(layout.createParallelGroup(GroupLayout.BASELINE).add(jButton1).add(jButton2)).addContainerGap()));pack();}// </editor-fold>//GEN-END:initComponentsprivate void jButton1ActionPerformed(ActionEvent evt) {//获取输入框的值String name = this.name.getText();//姓名String idNum = this.idNum.getText();//身份证号String roomNum = this.roomNum.getText();//房间号String money = this.money.getText();//费用//验证值是否为空if("".equals(name) || name == null){JOptionPane.showMessageDialog(null, "请输入姓名");return;}if("".equals(idNum) || idNum == null){JOptionPane.showMessageDialog(null, "请输入身份证号码");return;}if("".equals(roomNum) || roomNum == null){JOptionPane.showMessageDialog(null, "请输入房间号");return;}if("".equals(money) || money == null){JOptionPane.showMessageDialog(null, "请输入入住费用");}//封装对象ZhuHu household = new ZhuHu();household.setName(name);household.setIdNum(idNum);household.setRoomNum(Integer.parseInt(roomNum));household.setMoney(Integer.parseInt(money));household.setState("入住中");Connection con = null;try {con = dbUtil.getCon();KeFang gr = new KeFang();//判断房间是否存在或者是否已有人入住gr = guestRoomDao.findByRoomNum(con, Integer.parseInt(roomNum));if(gr == null){JOptionPane.showMessageDialog(null, "未查询到客房信息");return;}if(gr.getState() == 1){JOptionPane.showMessageDialog(null, "房间占用,请重新选择房间");return;}int result = householdDao.addHousehold(con, household);if(result != 0){JOptionPane.showMessageDialog(null, "添加成功");reset();//更新房间状态未已入住KeFang guestRoom = new KeFang();guestRoom.setNum(Integer.parseInt(roomNum));guestRoom.setState(1);guestRoomDao.updateState(con, guestRoom);//添加收银信息ShouYin cashier = new ShouYin();cashier.setType("收入");cashier.setMoney(money);cashier.setRemarks("用户"+name+"入住收入金额"+money);cashierDao.addCashier(con, cashier);}else{JOptionPane.showMessageDialog(null, "添加失败");}} catch (Exception e) {JOptionPane.showMessageDialog(null, "添加失败");e.printStackTrace();}finally{try {dbUtil.closeCon(con);//关闭数据库连接} catch (Exception e) {e.printStackTrace();}}}//清空输入框的值public void reset(){this.name.setText("");this.idNum.setText("");this.roomNum.setText("");this.money.setText("");}//窗口控件private JTextField idNum;private	JButton jButton1;private JButton jButton2;private JLabel jLabel1;private JLabel jLabel2;private JLabel jLabel3;private JLabel jLabel4;private JTextField money;private JTextField name;private JTextField roomNum;}

3.BookManger

/** BookManger.java** Created on __DATE__, __TIME__*/package hotel.view;import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;import hotel.dao.YuDingDao;
import hotel.model.YuDing;
import hotel.util.DbUtil;import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;import org.jdesktop.layout.GroupLayout;
import org.jdesktop.layout.LayoutStyle;
/***添加预订信息* @author Administrator**/
public class BookManger extends javax.swing.JInternalFrame {//实例化对象DbUtil dbUtil = new DbUtil();YuDingDao bookDao = new YuDingDao();/** 创建窗口 */public BookManger() {initComponents();this.setLocation(200, 50);//设置窗口位置}//初始化控件private void initComponents() {jLabel1 = new JLabel();name = new JTextField();jLabel2 = new JLabel();phone = new JTextField();jLabel3 = new JLabel();checkTime = new JTextField();save = new JButton();jButton2 = new JButton();setClosable(true);setIconifiable(true);setTitle("预订管理");jLabel1.setText("姓名");jLabel2.setText("联系电话");jLabel3.setText("入住时间");save.setText("保存");save.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent evt) {saveActionPerformed(evt);}});jButton2.setText("重置");/*** layout布局*/GroupLayout layout = new GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.LEADING).add(layout.createSequentialGroup().add(layout.createParallelGroup(GroupLayout.LEADING).add(layout.createSequentialGroup().add(32,32,32).add(layout.createParallelGroup(GroupLayout.LEADING).add(jLabel3).add(jLabel2).add(jLabel1)).addPreferredGap(LayoutStyle.RELATED).add(layout.createParallelGroup(GroupLayout.LEADING,false).add(GroupLayout.TRAILING,phone,GroupLayout.DEFAULT_SIZE,153,Short.MAX_VALUE).add(save).add(checkTime).add(GroupLayout.TRAILING,name))).add(layout.createSequentialGroup().add(186,186,186).add(jButton2))).addContainerGap(89, Short.MAX_VALUE)));layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.LEADING).add(layout.createSequentialGroup().add(30, 30, 30).add(layout.createParallelGroup(GroupLayout.BASELINE).add(jLabel1).add(name,GroupLayout.PREFERRED_SIZE,GroupLayout.DEFAULT_SIZE,GroupLayout.PREFERRED_SIZE)).addPreferredGap(LayoutStyle.RELATED).add(layout.createParallelGroup(GroupLayout.BASELINE).add(jLabel2).add(phone,GroupLayout.PREFERRED_SIZE,GroupLayout.DEFAULT_SIZE,GroupLayout.PREFERRED_SIZE)).addPreferredGap(LayoutStyle.RELATED).add(layout.createParallelGroup(GroupLayout.BASELINE).add(jLabel3).add(checkTime,GroupLayout.PREFERRED_SIZE,GroupLayout.DEFAULT_SIZE,GroupLayout.PREFERRED_SIZE)).addPreferredGap(LayoutStyle.RELATED,28, Short.MAX_VALUE).add(layout.createParallelGroup(GroupLayout.BASELINE).add(jButton2).add(save)).addContainerGap()));pack();}/*** 保存按钮事件* @param evt*/private void saveActionPerformed(java.awt.event.ActionEvent evt) {String name = this.name.getText();//姓名String phone = this.phone.getText();//联系电话String checkTime = this.checkTime.getText();//预订入住时间//验证数据是否为空if (name == null || "".equals(name)) {JOptionPane.showMessageDialog(null, "请输入入住人姓名");}if (phone == null || "".equals(phone)) {JOptionPane.showMessageDialog(null, "请输入联系电话");}if (checkTime == null || "".equals(checkTime)) {JOptionPane.showMessageDialog(null, "请输入入住时间");}//封装数据对象YuDing book = new YuDing();book.setName(name);book.setPhone(phone);book.setCheckTime(checkTime);book.setState("已预订");Connection con = null;//保存数据try {con = dbUtil.getCon();int result = bookDao.addBook(con, book);if (result != 0) {JOptionPane.showMessageDialog(null, "保存成功");reset();} else {JOptionPane.showMessageDialog(null, "保存失败");}} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();JOptionPane.showMessageDialog(null, "保存失败");}finally{try {dbUtil.closeCon(con);//关闭数据库连接} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}}}//清空输入框的值private void reset() {this.name.setText("");this.phone.setText("");this.checkTime.setText("");}/** 控件 */private JTextField checkTime;private JButton jButton2;private JLabel jLabel1;private JLabel jLabel2;private JLabel jLabel3;private JTextField name;private JTextField phone;private JButton save;}

4.editAdmin

 * editAdmin.java** Created on __DATE__, __TIME__*/package hotel.view;import hotel.dao.BianJiDao;
import hotel.util.DbUtil;import java.sql.Connection;import javax.swing.JOptionPane;/**** @author  __USER__*/
public class editAdmin extends javax.swing.JInternalFrame {DbUtil dbUtil = new DbUtil();BianJiDao editModulDao = new BianJiDao();/** Creates new form editAdmin */public editAdmin() {initComponents();}/** This method is called from within the constructor to* initialize the form.* WARNING: Do NOT modify this code. The content of this method is* always regenerated by the Form Editor.*///GEN-BEGIN:initComponents// <editor-fold defaultstate="collapsed" desc="Generated Code">private void initComponents() {jLabel1 = new javax.swing.JLabel();jTextField1 = new javax.swing.JTextField();jLabel2 = new javax.swing.JLabel();password = new javax.swing.JPasswordField();jLabel3 = new javax.swing.JLabel();repassword = new javax.swing.JPasswordField();jButton1 = new javax.swing.JButton();jLabel4 = new javax.swing.JLabel();oldpassword = new javax.swing.JPasswordField();setClosable(true);setResizable(true);jLabel1.setText("\u7528\u6237\u540d");jTextField1.setText("admin");jTextField1.addActionListener(new java.awt.event.ActionListener() {public void actionPerformed(java.awt.event.ActionEvent evt) {jTextField1ActionPerformed(evt);}});jLabel2.setText("\u65b0\u5bc6\u7801");password.addActionListener(new java.awt.event.ActionListener() {public void actionPerformed(java.awt.event.ActionEvent evt) {passwordActionPerformed(evt);}});jLabel3.setText("\u786e\u8ba4\u5bc6\u7801");jButton1.setText("\u4fee\u6539");jButton1.addActionListener(new java.awt.event.ActionListener() {public void actionPerformed(java.awt.event.ActionEvent evt) {jButton1ActionPerformed(evt);}});jLabel4.setText("\u65e7\u5bc6\u7801");org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().add(26, 26, 26).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING).add(jLabel3).add(jLabel2).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel4).add(jLabel1))).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING,false).add(oldpassword, 0, 0,Short.MAX_VALUE).add(jTextField1,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,181, Short.MAX_VALUE).add(repassword, 0, 0,Short.MAX_VALUE).add(password, 0, 0,Short.MAX_VALUE))).add(layout.createSequentialGroup().add(134, 134, 134).add(jButton1))).addContainerGap(82, Short.MAX_VALUE)));layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().add(26, 26, 26).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jTextField1,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(jLabel1)).add(18, 18, 18).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel4).add(oldpassword,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).add(12, 12, 12).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(password,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(jLabel2)).addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(repassword,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(jLabel3)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 23,Short.MAX_VALUE).add(jButton1).add(28, 28, 28)));pack();}// </editor-fold>//GEN-END:initComponentsprivate void passwordActionPerformed(java.awt.event.ActionEvent evt) {// TODO add your handling code here:}private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {Connection con = null;String password = new String(this.password.getPassword());String repassword = new String(this.repassword.getPassword());String oldpassword = new String(this.oldpassword.getPassword());try {con = dbUtil.getCon();String oldpwd = editModulDao.oldPassword(con);if(!oldpassword.equals(oldpwd)){JOptionPane.showMessageDialog(null, "旧密码不符");return;}} catch (Exception e1) {e1.printStackTrace();}if (password == null || "".equals(password)) {JOptionPane.showMessageDialog(null, "请输入密码");return;}if (!password.equals(repassword)) {JOptionPane.showMessageDialog(null, "两次输入密码不一致");return;}//修改数据库操作try {con = dbUtil.getCon();int result = editModulDao.updateAdmin(con, password);if (result != 0) {JOptionPane.showMessageDialog(null, "修改成功");this.password.setText("");} else {JOptionPane.showMessageDialog(null, "修改失败");}} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();} finally {try {dbUtil.closeCon(con);//关闭数据库连接} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}}}private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {// TODO add your handling code here:}//GEN-BEGIN:variables// Variables declaration - do not modifyprivate javax.swing.JButton jButton1;private javax.swing.JLabel jLabel1;private javax.swing.JLabel jLabel2;private javax.swing.JLabel jLabel3;private javax.swing.JLabel jLabel4;private javax.swing.JTextField jTextField1;private javax.swing.JPasswordField oldpassword;private javax.swing.JPasswordField password;private javax.swing.JPasswordField repassword;// End of variables declaration//GEN-END:variables}```## 5.editData
```java
/** editData.java** Created on __DATE__, __TIME__*/package hotel.view;import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;import org.jdesktop.layout.GroupLayout;
import org.jdesktop.layout.LayoutStyle;import hotel.dao.BianJiDao;
import hotel.util.DbUtil;/*** 修改管理员资料* @author Administrator**/
public class editData extends javax.swing.JInternalFrame {DbUtil dbUtil = new DbUtil();BianJiDao editModulDao = new BianJiDao();/** Creates new form editData */public editData() {initComponents();this.setLocation(300, 100);//设置窗口位置}/** 控件 */private void initComponents() {jLabel1 = new JLabel();jTextField1 = new JTextField();jLabel2 = new JLabel();password = new JPasswordField();password2 = new JPasswordField();jButton1 = new JButton();reset = new JButton();setClosable(true);setTitle("修改资料");jLabel1.setText("账号");jTextField1.setEditable(false);jTextField1.setText("admin");jLabel2.setText("密码");jButton1.setText("修改");jButton1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent evt) {jButton1ActionPerformed(evt);}});reset.setText("重置");reset.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent evt) {resetActionPerformed(evt);}});/*** layout布局*/GroupLayout layout = new GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.LEADING).add(layout.createSequentialGroup().add(29, 29, 29).add(layout.createParallelGroup(GroupLayout.LEADING,false).add(layout.createSequentialGroup().add(jLabel1).add(18,18,18).add(jTextField1,GroupLayout.PREFERRED_SIZE,172,GroupLayout.PREFERRED_SIZE)).add(layout.createSequentialGroup().add(jLabel2).add(18,18,18).add(layout.createParallelGroup(GroupLayout.LEADING).add(password,0,0,Short.MAX_VALUE).add(layout.createSequentialGroup().add(jButton1).addPreferredGap(LayoutStyle.RELATED,35,Short.MAX_VALUE).add(reset).add(23,23,23))))).addContainerGap(52, Short.MAX_VALUE)));layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.LEADING).add(layout.createSequentialGroup().add(31, 31, 31).add(layout.createParallelGroup(GroupLayout.BASELINE).add(jLabel1).add(jTextField1,GroupLayout.PREFERRED_SIZE,GroupLayout.DEFAULT_SIZE,GroupLayout.PREFERRED_SIZE)).add(18, 18, 18).add(layout.createParallelGroup(GroupLayout.BASELINE).add(jLabel2).add(password,GroupLayout.PREFERRED_SIZE,GroupLayout.DEFAULT_SIZE,GroupLayout.PREFERRED_SIZE)).add(18, 18, 18).add(layout.createParallelGroup(GroupLayout.BASELINE).add(jButton1).add(reset)).addContainerGap(35, Short.MAX_VALUE)));pack();}/*** 修改管理员资料*///修改按钮事件private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {String password = new String(this.password.getPassword());String repassword = new String(this.password2.getPassword());if (password == null || "".equals(password)) {JOptionPane.showMessageDialog(null, "请输入密码");return;}if(!password.equals(repassword)){JOptionPane.showMessageDialog(null, "两次输入密码不一致");return;}Connection con = null;//修改数据库操作try {con = dbUtil.getCon();int result = editModulDao.updateAdmin(con, password);if (result != 0) {JOptionPane.showMessageDialog(null, "修改成功");this.password.setText("");} else {JOptionPane.showMessageDialog(null, "修改失败");}} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();} finally {try {dbUtil.closeCon(con);//关闭数据库连接} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}}}//重置输入框的值private void resetActionPerformed(ActionEvent evt) {this.password.setText("");}//页面控件private JButton jButton1;private JLabel jLabel1;private JLabel jLabel2;private JTextField jTextField1;private JPasswordField password;private JPasswordField password2;private JButton reset;}

5.inAccountManger

/** inAccountManger.java** Created on __DATE__, __TIME__*/package hotel.view;import hotel.dao.YuDingDao;
import hotel.dao.ShouYinDao;
import hotel.model.ShouYin;
import hotel.util.DbUtil;import java.sql.Connection;
import java.sql.ResultSet;
import java.util.Vector;import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;import com.sun.org.apache.bcel.internal.generic.NEW;/**** @author  __USER__*/
public class inAccountManger extends javax.swing.JInternalFrame {DbUtil dbUtil = new DbUtil();ShouYinDao cashierDao = new ShouYinDao();/** Creates new form inAccountManger */public inAccountManger() {initComponents();this.fillTable();this.setLocation(200, 50);//设置窗口位置}/*** 填充表格数据* @param name*/public void fillTable() {DefaultTableModel dtm = (DefaultTableModel) inAccountTable.getModel();dtm.setRowCount(0);Connection con = null;try {con = dbUtil.getCon();ResultSet re = cashierDao.cashier(con);while (re.next()) {Vector v = new Vector();//添加每一行的数据v.add(re.getString("id"));v.add(re.getString("type"));v.add(re.getString("money"));v.add(re.getString("remarks"));v.add(re.getString("time"));dtm.addRow(v);}} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();} finally {try {dbUtil.closeCon(con);} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}}}/** This method is called from within the constructor to* initialize the form.* WARNING: Do NOT modify this code. The content of this method is* always regenerated by the Form Editor.*///GEN-BEGIN:initComponents// <editor-fold defaultstate="collapsed" desc="Generated Code">private void initComponents() {jScrollPane1 = new javax.swing.JScrollPane();inAccountTable = new javax.swing.JTable();jPanel1 = new javax.swing.JPanel();jLabel1 = new javax.swing.JLabel();money = new javax.swing.JTextField();jLabel2 = new javax.swing.JLabel();remarks = new javax.swing.JTextField();add = new javax.swing.JButton();jLabel3 = new javax.swing.JLabel();type = new javax.swing.JTextField();setClosable(true);setIconifiable(true);setTitle("\u5165\u8d26\u7ba1\u7406");inAccountTable.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { { null, null, null, null, null },{ null, null, null, null, null },{ null, null, null, null, null },{ null, null, null, null, null } }, new String[] {"编号", "状态", "金额", "备注", "时间" }) {boolean[] canEdit = new boolean[] { false, false, false, false,false };public boolean isCellEditable(int rowIndex, int columnIndex) {return canEdit[columnIndex];}});jScrollPane1.setViewportView(inAccountTable);jLabel1.setText("\u91d1\u989d");jLabel2.setText("\u5907\u6ce8");add.setText("\u6dfb\u52a0");add.addActionListener(new java.awt.event.ActionListener() {public void actionPerformed(java.awt.event.ActionEvent evt) {addActionPerformed(evt);}});jLabel3.setText("\u7c7b\u578b");type.setEditable(false);type.setText("\u6536\u5165");type.addActionListener(new java.awt.event.ActionListener() {public void actionPerformed(java.awt.event.ActionEvent evt) {jTextField1ActionPerformed(evt);}});org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);jPanel1.setLayout(jPanel1Layout);jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel1Layout.createSequentialGroup().addContainerGap().add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING).add(add).add(jPanel1Layout.createSequentialGroup().add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING,false).add(org.jdesktop.layout.GroupLayout.LEADING,jPanel1Layout.createSequentialGroup().add(jLabel3).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(type)).add(jPanel1Layout.createSequentialGroup().add(jLabel1).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(money,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,176,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))).add(18,18,18).add(jLabel2).add(18,18,18).add(remarks,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,181,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))).addContainerGap(439, Short.MAX_VALUE)));jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel1Layout.createSequentialGroup().addContainerGap().add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel1).add(money,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(jLabel2).add(remarks,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).add(18, 18, 18).add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel3).add(type,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE).add(add)));org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(org.jdesktop.layout.GroupLayout.TRAILING,layout.createSequentialGroup().addContainerGap().add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING).add(org.jdesktop.layout.GroupLayout.LEADING,jPanel1,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE).add(org.jdesktop.layout.GroupLayout.LEADING,jScrollPane1,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,897, Short.MAX_VALUE)).addContainerGap()));layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().addContainerGap().add(jScrollPane1,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 131,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(jPanel1,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addContainerGap(30, Short.MAX_VALUE)));pack();}// </editor-fold>//GEN-END:initComponentsprivate void addActionPerformed(java.awt.event.ActionEvent evt) {String money = this.money.getText();String remarks = this.remarks.getText();String type = this.type.getText();if("".equals(money) || money == null){JOptionPane.showMessageDialog(null, "请输入金额");return;}if("".equals(remarks) || remarks == null){JOptionPane.showMessageDialog(null, "请输入备注");return;}ShouYin cashier = new ShouYin();cashier.setMoney(money);cashier.setRemarks(remarks);cashier.setType(type);Connection con  = null;	try {con = dbUtil.getCon();int result = cashierDao.addCashier(con, cashier);if(result != 0){JOptionPane.showMessageDialog(null, "添加成功!");this.fillTable();this.money.setText("");this.remarks.setText("");}} catch (Exception e) {JOptionPane.showMessageDialog(null, "添加失败!");e.printStackTrace();}}private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {// TODO add your handling code here:}//GEN-BEGIN:variables// Variables declaration - do not modifyprivate javax.swing.JButton add;private javax.swing.JTable inAccountTable;private javax.swing.JLabel jLabel1;private javax.swing.JLabel jLabel2;private javax.swing.JLabel jLabel3;private javax.swing.JPanel jPanel1;private javax.swing.JScrollPane jScrollPane1;private javax.swing.JTextField type;private javax.swing.JTextField money;private javax.swing.JTextField remarks;// End of variables declaration//GEN-END:variables}

6.login

/** login.java** Created on __DATE__, __TIME__*/package hotel.view;import hotel.dao.UserDao;
import hotel.model.User;
import hotel.util.DbUtil;import java.awt.Font;
import java.sql.Connection;import javax.swing.JOptionPane;
import javax.swing.UIManager;/**** @author  __USER__*/
public class login extends javax.swing.JFrame {DbUtil dbUtil = new DbUtil();UserDao userDao = new UserDao();/** Creates new form login */public login() {//改变系统默认字体Font font = new Font("Dialog", Font.PLAIN, 12);java.util.Enumeration keys = UIManager.getDefaults().keys();while (keys.hasMoreElements()) {Object key = keys.nextElement();Object value = UIManager.get(key);if (value instanceof javax.swing.plaf.FontUIResource) {UIManager.put(key, font);}}initComponents();// 设置Frame居中显示this.setLocationRelativeTo(null);}/** This method is called from within the constructor to* initialize the form.* WARNING: Do NOT modify this code. The content of this method is* always regenerated by the Form Editor.*///GEN-BEGIN:initComponents// <editor-fold defaultstate="collapsed" desc="Generated Code">private void initComponents() {jLabel1 = new javax.swing.JLabel();jLabel2 = new javax.swing.JLabel();userName = new javax.swing.JTextField();password = new javax.swing.JPasswordField();login = new javax.swing.JButton();reset = new javax.swing.JButton();setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);setTitle("\u7ba1\u7406\u5458\u767b\u9646");jLabel1.setText("\u767b\u5f55\u540d");jLabel2.setText("\u5bc6\u7801");login.setText("\u767b\u9646");login.addActionListener(new java.awt.event.ActionListener() {public void actionPerformed(java.awt.event.ActionEvent evt) {loginActionPerformed(evt);}});reset.setText("\u91cd\u7f6e");org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().add(39,39,39).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel1).add(jLabel2)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING,false).add(password,0,0,Short.MAX_VALUE).add(userName,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,154,Short.MAX_VALUE))).add(layout.createSequentialGroup().add(81,81,81).add(login).add(18,18,18).add(reset))).addContainerGap(55, Short.MAX_VALUE)));layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().add(32, 32, 32).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel1).add(userName,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).add(18, 18, 18).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel2).add(password,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED,18, Short.MAX_VALUE).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(reset).add(login)).addContainerGap()));pack();}// </editor-fold>//GEN-END:initComponentsprivate void loginActionPerformed(java.awt.event.ActionEvent evt) {String userName = this.userName.getText();String password = new String(this.password.getPassword());if("".equals(userName) || userName == null){JOptionPane.showMessageDialog(null, "用户名不能为空");return;}if("".equals(password) || password == null){JOptionPane.showMessageDialog(null, "密码不能为空");return;}User user = new User();user.setUserName(userName);user.setPassword(password);Connection conn = null;try {conn = dbUtil.getCon();User us = userDao.login(conn, user);if(us == null){JOptionPane.showMessageDialog(null, "用户名或密码错误");}else{this.dispose();new main().setVisible(true);}} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}finally{try {dbUtil.closeCon(conn);} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}}}/*** @param args the command line arguments*/public static void main(String args[]) {java.awt.EventQueue.invokeLater(new Runnable() {public void run() {new login().setVisible(true);}});}//GEN-BEGIN:variables// Variables declaration - do not modifyprivate javax.swing.JLabel jLabel1;private javax.swing.JLabel jLabel2;private javax.swing.JButton login;private javax.swing.JPasswordField password;private javax.swing.JButton reset;private javax.swing.JTextField userName;// End of variables declaration//GEN-END:variables}

五、联系与交流

扣:969060742 完整程序资源、sql、代码

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/213378.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

0009Java程序设计-ssm微信小程序在慢性疾病管理中的应用

文章目录 **摘要**目录系统实现开发环境 编程技术交流、源码分享、模板分享、网课分享 企鹅&#x1f427;裙&#xff1a;776871563 摘要 首先,论文一开始便是清楚的论述了小程序的研究内容。其次,剖析系统需求分析,弄明白“做什么”,分析包括业务分析和业务流程的分析以及用例…

极坐标曲线@典型的4种曲线

文章目录 abstract典型曲线心形线玫瑰线阿基米德螺线伯努利双扭线 abstract 除了圆和圆锥曲线外,还有许多曲线用极坐标描述会简单得多 典型曲线 分析下列曲线时,线分析是否含有三角函数(周期性) 利用描点法做出单个周期内的图形 作图:可以打开geogebra https://www.geogebr…

银行插件导致的Outlook客户端无法连接服务器问题

问题现象 最近遇到好些同事出现outlook客户端无法连接服务器的情况&#xff0c;具体现象就是右下角一直显示【正在尝试连接…】或者【需要密码】&#xff0c;点击【需要密码】按钮&#xff0c;输密码的弹窗是一个完全空白的页面。 此时打开word&#xff0c;右上角那里去登录o…

智能优化算法应用:基于缎蓝园丁鸟算法3D无线传感器网络(WSN)覆盖优化 - 附代码

智能优化算法应用&#xff1a;基于缎蓝园丁鸟算法3D无线传感器网络(WSN)覆盖优化 - 附代码 文章目录 智能优化算法应用&#xff1a;基于缎蓝园丁鸟算法3D无线传感器网络(WSN)覆盖优化 - 附代码1.无线传感网络节点模型2.覆盖数学模型及分析3.缎蓝园丁鸟算法4.实验参数设定5.算法…

自动数据增广论文笔记 | AutoAugment: Learning Augmentation Strategies from Data

谷歌大脑出品 paper: https://arxiv.org/abs/1805.09501 这里是个论文的阅读心得&#xff0c;笔记&#xff0c;不等同论文全部内容 文章目录 一、摘要1.1 翻译1.2 笔记 二、(第三部分)自动增强:直接在感兴趣的数据集上搜索最佳增强策略2.1 翻译2.2 笔记 三、(第四部分)实验与结…

为什么说数字化转型能帮助企业降本增效?

引言 数字化转型是当今商业领域中的关键议题&#xff0c;它不仅是技术的应用&#xff0c;更是一种战略性的变革&#xff0c;对企业而言具有重要意义。在这个数字化时代&#xff0c;企业需要不断适应和采纳新技术&#xff0c;以获得竞争优势并提高效率。 数字化转型旨在将传统业…

匿名内部类 - ( 零基础学java )

Java-匿名内部类 我们先分析匿名内部类的结构,然后逐一解释,最后以下罗列的问题都会在下面的内容中一一得到解答 : 匿名内部类到底是什么? 我们为什么要学习匿名内部类 ? 匿名内部类都有怎样的作用 ? 匿名内部类应用的场景又有哪些 ? 匿名内部类是否有缺陷? 让我们…

Java (JDK 21) 调用 OpenCV (4.8.0)

Java 调用 OpenCV 一.OpenCV 下载和安装二.创建 Java Maven 项目三.其他测试 一.OpenCV 下载和安装 Open CV 官网 可以下载编译好的包&#xff0c;也可以下载源码自行编译 双击安装 opencv-4.8.0-windows.exe 默认为当前目录 安装即解压缩 根据系统位数选择 将 x64 目录下 op…

开往渤海的列车:沧港铁路如何扮演产业带城市生态共赢的关键先生

新时代构建新格局&#xff0c;新格局呼唤新作为。在交通强国战略背景下&#xff0c;铁路运输企业需要如何彰显“铁担当”&#xff1f; 逢山开路、遇水架桥&#xff0c;身处重要地理区位&#xff0c;沧州沧港铁路有限公司&#xff08;以下简称“沧港铁路”&#xff09;不断抢抓…

并查集带压缩路径的find

目录 原因&#xff1a; 优化&#xff1a; 原因&#xff1a; 当路径比较特殊&#xff0c;如图&#xff1a; 非常深&#xff0c;最底层进行find时&#xff0c;循环找根&#xff08;或者递归找&#xff09;&#xff0c;消耗就比较大。 我们可以进行优化。 优化&#xff1a; &…

【C++】C++异常语法、使用、规范、异常安全及异常的优缺点

1. C异常概念 异常是一种处理错误的方式&#xff0c;当一个函数发现自己无法处理的错误时就可以抛出异常&#xff0c;让函数的直接或间接的调用者处理这个错误。 throw: 当问题出现时&#xff0c;程序会抛出一个异常。这是通过使用 throw 关键字来完成的。catch: 在您想要处理…

给你的Python程序添点Emoji魔法:使用Emoji模块增添趣味和个性!

当你想给你的Python程序增添一些趣味和个性时&#xff0c;Emoji模块是一个很有用的工具。Emoji模块允许你在Python中使用各种表情符号&#xff0c;从笑脸到动物&#xff0c;甚至是食物和天气等。在本篇博客中&#xff0c;我们将介绍如何在Python中使用Emoji模块&#xff0c;并展…

【小白专用】使用PHP创建和操作MySQL数据库,数据表

php数据库操作 php连接mysql数据库 <?php $hostlocalhost; // 数据库主机名 $username"root"; // 数据库用户名 $password"al6"; // 数据库密码 $dbname"mysql"; // 数据库名 $connIDmysqli_connect($host,$username,$password,$dbn…

MQTT服务质量-QoS

QoS是消息发送方和接收方之间的协议&#xff0c;定义了指定消息发送保证等级。本文将深入探究MQTT中不同的QoS等级。 QoS是什么 MQTT提供三个QoS等级&#xff1a; 最多一次&#xff08;QoS 0&#xff09;至少一次&#xff08;QoS 1&#xff09;确切一次&#xff08;QoS 2&am…

科技提升安全,基于YOLOv5系列模型【n/s/m/l/x】开发构建商超扶梯场景下行人安全行为姿态检测识别系统

在商超等人流量较为密集的场景下经常会报道出现一些行人在扶梯上摔倒、受伤等问题&#xff0c;随着AI技术的快速发展与不断普及&#xff0c;越来越多的商超、地铁等场景开始加装专用的安全检测预警系统&#xff0c;核心工作原理即使AI模型与摄像头图像视频流的实时计算&#xf…

使用alpine镜像部署go应用时踩的坑

使用alpine镜像部署go应用时踩的坑 关于交叉编译 实际上我在ubuntu的交叉编译出来的exe并不能在alpine上运行&#xff0c;这边采取拉镜像编译复制出来的做法&#xff0c;部署再用干净的alpine 拉取golang:alpine踩坑 在Dockerhub上可以找到&#xff1a; 然而拉取的alpine中…

在普通的项目中创建web的功能

新增web功能: 1.创建一个新项目&#xff0c;不勾选模板&#xff1a;2.添加web功能&#xff1a; 1.创建一个新项目&#xff0c;不勾选模板&#xff1a; 发现普通项目没有webapp文件夹&#xff0c;即没有web的功能。 2.添加web功能&#xff1a; Add framework support:添加一些…

luceda ipkiss教程 45:在版图上加LOGO

**在设计版图时往往需要加上公司或者学校的LOGO,只需要LOGO的图片&#xff0c;通过代码就可以将LOGO加到版图上&#xff0c;比如&#xff1a; ** 通过代码可以得到版图上的LOGO: ! 代码如下&#xff1a; from si_fab import all as pdk from ipkiss3 import all as i3i3.TECH…

国际验证码有哪些具体的应用场景?

用户注册 在许多网站和应用程序中&#xff0c;用户注册是必要的第一步。通过使用验证码接口&#xff0c;可以防止恶意机器人或自动化程序大规模注册账号&#xff0c;从而保护网站或应用程序的安全性和可靠性。 密码重置 当用户忘记密码或需要重置密码时&#xff0c;验证码可…

MyBatis逆向工程

正向工程&#xff1a;先创建Java实体类&#xff0c;由框架负责根据实体类生成数据库表。Hibernate是支持正向工程的。逆向工程&#xff1a;先创建数据库表&#xff0c;由框架负责根据数据库表&#xff0c;反向生成如下资源&#xff1a; Java实体类Mapper接口Mapper映射文件 1…