基于java的Swing+MySQL酒店管理系统(java+swing+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

262023440609

282023440609

292023440609

302023440609

312023440609

322023440609

332023440609

342023440609

基于java的Swing+MySQL酒店管理系统(java+swing+mysql)

启动类:
LoginFra

登录:
01101 123456
01102 123456

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
			try {
RoomFra frame = new RoomFra();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

/**
* Create the frame.
*/
public RoomFra() {
setTitle("\u623F\u95F4\u67E5\u8BE2");//房间查询
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 669, 558);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);

JLabel label = new JLabel("\u623F\u95F4\u7F16\u53F7\uFF1A");//房间编号:
label.setFont(new Font("华文行楷", Font.PLAIN, 28));

rid_text = new JTextField();
rid_text.setColumns(10);

JLabel lblNewLabel = new JLabel("\u623F\u95F4\u7C7B\u578B\uFF1A");//房间编号:
lblNewLabel.setFont(new Font("华文行楷", Font.PLAIN, 28));

JButton btn_search = new JButton("\u67E5\u8BE2");//查询
btn_search.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btn_searchActionPerformed(evt);
}

});
btn_search.setForeground(new Color(139, 0, 0));
btn_search.setFont(new Font("华文行楷", Font.PLAIN, 28));

JScrollPane scrollPane = new JScrollPane();

JButton btn_return = new JButton("\u8FD4\u56DE");//返回
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
	.addGap(6)
.addComponent(id_text, GroupLayout.PREFERRED_SIZE, 215, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED, 36, Short.MAX_VALUE)
.addComponent(label_1)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(rid_text, GroupLayout.PREFERRED_SIZE, 122, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED, 56, Short.MAX_VALUE)
.addComponent(btn_search)
.addGap(24))
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(31)
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 678, GroupLayout.PREFERRED_SIZE)
.addGroup(gl_contentPane.createSequentialGroup()
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(17)
.addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
.addComponent(label_2)
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addComponent(label_6)
.addComponent(label_4)))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false)
.addComponent(leave_text)
.addComponent(ocdate_text)
.addComponent(cid_text, GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)))
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(72)
.addComponent(btn_delete)))
.addPreferredGap(ComponentPlacement.RELATED, 115, Short.MAX_VALUE)
.addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false)
.addGroup(gl_contentPane.createSequentialGroup()
.addComponent(label_5)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(exday_text))
.addGroup(gl_contentPane.createSequentialGroup()
.addComponent(label_3)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(rid_text1, GroupLayout.PREFERRED_SIZE, 160, GroupLayout.PREFERRED_SIZE)))
.addGroup(gl_contentPane.createSequentialGroup()
.addComponent(btn_return)
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
				new MainFra().setVisible(true);
}else{
JOptionPane.showMessageDialog(null, "用户名或者密码错误!");
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
try {
dbUtil.closeCon(con);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

/**
* 重置事件处理
* @param e
*/
private void btn_cancelActionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
this.userName_text.setText("");
this.password_text.setText("");
}
}




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

public class CheckFra extends JFrame {

private JPanel contentPane;
private JTextField cid_text;
private JTextField rid_text;
private JTextField cdate_text;
private JTextField day_text;
private JTextField ldate_text;
private DbUtil dbUtil = new DbUtil();
private OrderDao orderDao = new OrderDao();

/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
CheckFra frame = new CheckFra();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

/**
* Create the frame.
*/
public CheckFra() {
setTitle("\u8BA2\u5355\u8BE6\u60C5");//订单详情
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 656, 543);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);

JLabel lblNewlabel = new JLabel("\u8EAB\u4EFD\u8BC1\u53F7\u7801\uFF1A");//身份证号码:
lblNewlabel.setFont(new Font("华文行楷", Font.PLAIN, 16));

cid_text = new JTextField();
cid_text.setColumns(10);

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

});
btn_update.setFont(new Font("华文行楷", Font.PLAIN, 18));

JButton btn_delete = new JButton("\u5220\u9664");
btn_delete.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btn_deleteActionPerformed(evt);
}

});
btn_delete.setFont(new Font("华文行楷", Font.PLAIN, 18));

JButton btn_return = new JButton("\u8FD4\u56DE");
btn_return.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent evt) {
btn_returnMouseClicked(evt);
}

});
btn_return.setIcon(new ImageIcon(StaffInfoFra.class.getResource("/image/return.png")));
btn_return.setFont(new Font("华文行楷", Font.PLAIN, 18));

ssex_text = new JTextField();
ssex_text.setColumns(10);
GroupLayout gl_panel_1 = new GroupLayout(panel_1);
gl_panel_1.setHorizontalGroup(
gl_panel_1.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_1.createSequentialGroup()
.addGap(49)
.addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_1.createSequentialGroup()
.addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING)
.addComponent(lblid_1)
.addComponent(label_1))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_1.createSequentialGroup()
.addComponent(sid_text, GroupLayout.PREFERRED_SIZE, 114, GroupLayout.PREFERRED_SIZE)
.addGap(52)
.addComponent(label)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(sname_text, GroupLayout.PREFERRED_SIZE, 124, GroupLayout.PREFERRED_SIZE))
.addComponent(ssex_text)))
.addGroup(gl_panel_1.createSequentialGroup()
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(label_2)
.addPreferredGap(ComponentPlacement.RELATED)
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
		dtm.setRowCount(0); // 设置成0行
Connection con=null;
try{
con=dbUtil.getCon();
ResultSet rs=roomDao.list(con, room);
while(rs.next()){
Vector v=new Vector();
v.add(rs.getString("rid"));
v.add(rs.getString("rtype"));
v.add(rs.getString("rprice"));
v.add(rs.getString("rstate"));
dtm.addRow(v);
}
}catch(Exception e){
e.printStackTrace();
}finally{
try {
dbUtil.closeCon(con);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}
}





项目链接:
https://javayms.github.io?id=252023440609201ev
https://javayms.pages.dev?id=252023440609201ev