Repository navigation
Expand file tree
/
Copy pathAccountManagement.java
More file actions
135 lines (117 loc) · 2.92 KB
/
Copy pathAccountManagement.java
File metadata and controls
135 lines (117 loc) · 2.92 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package view;
/**
* 用户账户管理界面
* @author K.X
*
* */
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class AccountManagement {
/*
* 标签
*
* 四个按钮 修改账号 修改密码 借书记录 退出程序
*
*/
// 面板
public JPanel jPanel2 = new JPanel();
// 标签
private JLabel jLabel = new JLabel("账户管理");
// 按钮
private JButton button = new JButton("修改信息");
private JButton button2 = new JButton("修改密码");
private JButton button3 = new JButton("借书记录");
private JButton button4 = new JButton("退出登陆");
// 字体
private Font font = new Font("宋体", Font.BOLD, 60);
private Font font1 = new Font("宋体", Font.BOLD, 25);
private String user;
private JFrame frame;
public AccountManagement() {
// 改变背景图片
Icon i = new ImageIcon("img\\account.jpg");
JLabel Label = new JLabel(i);
Label.setBounds(0, 0, 1200, 800);
// 面板布局为空
jPanel2.setLayout(null);
// 标签
jLabel.setFont(font);
jLabel.setBounds(460, 50, 800, 70);
// 按钮
button.setFont(font1);
button2.setFont(font1);
button3.setFont(font1);
button4.setFont(font1);
button.setBounds(150, 250, 250, 50);
button2.setBounds(150, 310, 250, 50);
button3.setBounds(150, 370, 250, 50);
button4.setBounds(150, 430, 250, 50);
button.setBackground(Color.cyan);
button2.setBackground(Color.cyan);
button3.setBackground(Color.cyan);
button4.setBackground(Color.cyan);
button.setOpaque(false);
button2.setOpaque(false);
button3.setOpaque(false);
button4.setOpaque(false);
// 添加事件
add();
jPanel2.add(button);
jPanel2.add(button2);
jPanel2.add(button3);
jPanel2.add(button4);
jPanel2.add(jLabel);
jPanel2.add(Label);
}
public void setUser(String user) {
this.user = user;
}
public void setFrame(JFrame frame) {
this.frame = frame;
}
// 添加事件
private void add() {
// 修改信息
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new ModifyInformation(user);
}
});
// 修改密码
button2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
ModifyPassword password = new ModifyPassword(user);
password.setFrame(frame);
}
});
//借书记录
button3.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new BorrowRecords(user);
}
});
//退出登陆
button4.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
frame.dispose();
new Land();
}
});
}
}