基于java的Swing+MySQL游泳馆会员管理系统(java+swing+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

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

适用

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

功能说明

412123120309

422123120309

432123120309

442123120309

452123120309

基于java的Swing+MySQL游泳馆会员管理系统(java+swing+mysql)

管理员:
admin 123456

用户:
王一 01
王二 02
王三 03

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

JButton btnNewButton_3 = new JButton("存款管理");
btnNewButton_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
SetAmount sa = new SetAmount();
sa.init();

}
});
btnNewButton_3.setFont(new Font("宋体", Font.PLAIN, 20));
btnNewButton_3.setBounds(54, 181, 159, 39);
contentPane.add(btnNewButton_3);

JButton btnNewButton_4 = new JButton("退卡");
btnNewButton_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ReturnCard rc = new ReturnCard();
rc.init();
}
});
btnNewButton_4.setFont(new Font("宋体", Font.PLAIN, 20));
btnNewButton_4.setBounds(54, 242, 159, 39);
contentPane.add(btnNewButton_4);

JButton btnNewButton_5 = new JButton("会员禁用");
btnNewButton_5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
DisableCard dc = new DisableCard();
dc.init();
}
});
btnNewButton_5.setFont(new Font("宋体", Font.PLAIN, 20));
btnNewButton_5.setBounds(323, 242, 158, 39);
contentPane.add(btnNewButton_5);

JButton btnNewButton_6 = new JButton("消费管理");
btnNewButton_6.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ConsumeHistory ch = new ConsumeHistory();
ch.init();
}
});
btnNewButton_6.setFont(new Font("宋体", Font.PLAIN, 20));
btnNewButton_6.setBounds(54, 307, 159, 39);
contentPane.add(btnNewButton_6);

JButton btnNewButton_7 = new JButton("系统管理");
btnNewButton_7.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
SystemManagement sm = new SystemManagement();
sm.init();
}
});
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
		PreparedStatement ps=null;
Conn conn1 = new Conn();
conn1.getConn();
String cardnumber = textField.getText();
String sql="update cards set card_status=? where card_num=?";
ps=conn1.getConn().prepareStatement(sql);
ps.setString(1, "禁用");
ps.setString(2, cardnumber);
int n= ps.executeUpdate();
ps.clearParameters();
ps.close();
conn1.getConn().close();
JOptionPane.showMessageDialog(null, "已禁用");
}catch(Exception e1) {
e1.printStackTrace();
}
}
});
btnNewButton.setFont(new Font("宋体", Font.PLAIN, 20));
btnNewButton.setBounds(96, 197, 93, 29);
contentPane.add(btnNewButton);

JButton btnNewButton_1 = new JButton("解禁");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
PreparedStatement ps=null;
Conn conn1 = new Conn();
conn1.getConn();
String cardnumber = textField.getText();
String sql="update cards set card_status=? where card_num=?";
ps=conn1.getConn().prepareStatement(sql);
ps.setString(1, "正常");
ps.setString(2, cardnumber);
int n= ps.executeUpdate();
ps.clearParameters();
ps.close();
conn1.getConn().close();
JOptionPane.showMessageDialog(null, "已解禁");
}catch(Exception e1) {
e1.printStackTrace();
}
}
});
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
public SellCards() {
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
setBounds(100, 100, 655, 528);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);

JLabel lblNewLabel = new JLabel("请输入...");
lblNewLabel.setBounds(82, 17, 109, 32);
lblNewLabel.setFont(new Font("宋体", Font.PLAIN, 20));
contentPane.add(lblNewLabel);

textField = new JTextField();
textField.setBounds(341, 16, 165, 39);
contentPane.add(textField);
textField.setColumns(10);

JLabel lblNewLabel_1 = new JLabel("姓名:");
lblNewLabel_1.setBounds(227, 16, 88, 39);
lblNewLabel_1.setFont(new Font("宋体", Font.PLAIN, 20));
contentPane.add(lblNewLabel_1);

JLabel lblNewLabel_2 = new JLabel("卡号:");
lblNewLabel_2.setBounds(227, 78, 80, 39);
lblNewLabel_2.setFont(new Font("宋体", Font.PLAIN, 20));
contentPane.add(lblNewLabel_2);

textField_1 = new JTextField();
textField_1.setBounds(342, 80, 164, 39);
contentPane.add(textField_1);
textField_1.setColumns(10);

JLabel lblNewLabel_3 = new JLabel("折扣:");
lblNewLabel_3.setBounds(227, 269, 65, 39);
lblNewLabel_3.setFont(new Font("宋体", Font.PLAIN, 20));
contentPane.add(lblNewLabel_3);

textField_2 = new JTextField();
textField_2.setBounds(342, 271, 164, 39);
contentPane.add(textField_2);
textField_2.setColumns(10);

JLabel lblNewLabel_4 = new JLabel("证件号:");
lblNewLabel_4.setBounds(227, 145, 85, 43);
lblNewLabel_4.setFont(new Font("宋体", Font.PLAIN, 20));
contentPane.add(lblNewLabel_4);

textField_3 = new JTextField();
textField_3.setBounds(334, 147, 172, 43);
contentPane.add(textField_3);
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

}

/**
* Create the frame.
*/
public UserHomePage() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 320);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);

JLabel lblNewLabel = new JLabel("欢迎使用游泳馆管理系统");
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
lblNewLabel.setFont(new Font("宋体", Font.PLAIN, 30));
lblNewLabel.setBounds(0, 10, 426, 49);
contentPane.add(lblNewLabel);

JLabel lblNewLabel_1 = new JLabel("姓名:");
lblNewLabel_1.setFont(new Font("宋体", Font.PLAIN, 20));
lblNewLabel_1.setBounds(104, 81, 66, 26);
contentPane.add(lblNewLabel_1);

textField = new JTextField();
textField.setBounds(180, 86, 110, 21);
contentPane.add(textField);
textField.setColumns(10);

JLabel lblNewLabel_1_1 = new JLabel("卡号:");
lblNewLabel_1_1.setFont(new Font("宋体", Font.PLAIN, 20));
lblNewLabel_1_1.setBounds(104, 133, 66, 26);
contentPane.add(lblNewLabel_1_1);

textField_1 = new JTextField();
textField_1.setColumns(10);
textField_1.setBounds(179, 138, 110, 21);
contentPane.add(textField_1);

JLabel lblNewLabel_2 = new JLabel("30元/次");
lblNewLabel_2.setFont(new Font("微软雅黑", Font.PLAIN, 16));
lblNewLabel_2.setBounds(165, 181, 75, 27);
contentPane.add(lblNewLabel_2);

JButton btnNewButton = new JButton("使用会员卡");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
PreparedStatement ps = null;
Conn conn1 = new Conn();
conn1.getConn();
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
			ResultSet rs = ps.executeQuery();
int count = 0;
while(rs.next()){
count++;
}
if(count==0) {
JOptionPane.showMessageDialog(null, "没有此会员");
}
rs = ps.executeQuery();
Object[][] info = new Object[count][6];
count = 0;
while(rs.next()){
info[count][0] = rs.getString("card_num");
info[count][1] = rs.getString("vip_name");
info[count][2] = rs.getString("deposit_amount");
info[count][3] = rs.getString("amount");
info[count][4] = rs.getString("balance");
info[count][5] = rs.getString("consume_time");

count++;
}


String[] title = {"卡号", "姓名", "存款金额", "消费金额", "结存余额", "消费时间"};
JTable table1 = new JTable(info,title);
table1.setFont(new Font("宋体", Font.PLAIN, 10));
scrollPane.setViewportView(table1);
contentPane.add(scrollPane);

}catch(Exception e1) {
e1.printStackTrace();
}

}
});
btnNewButton.setBounds(434, 15, 81, 24);

btnNewButton.setFont(new Font("宋体", Font.PLAIN, 18));
contentPane.add(btnNewButton);

textField_2 = new JTextField();
textField_2.setBounds(300, 17, 124, 24);
textField_2.setColumns(10);
contentPane.add(textField_2);

JLabel lblNewLabel_2 = new JLabel("时间下限:");


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