forked from kongxin-github/Java_Library_Management_System
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainInterface.java
More file actions
99 lines (80 loc) · 2.34 KB
/
MainInterface.java
File metadata and controls
99 lines (80 loc) · 2.34 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
package view;
import java.awt.Color;
import java.awt.Container;
import java.awt.Font;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.Icon;
import javax.swing.ImageIcon;
/**
* 主界面
* @author K.X
*
* */
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import database.Landing;
public class MainInterface extends JFrame{
/*
* 选项卡 主界面 图书查询 图书借还 账号管理
*
* */
//选项卡
public JTabbedPane jTabbedPane = new JTabbedPane();
//主界面面板
private JPanel jPanel = new JPanel();
//标签
private JLabel jLabel = new JLabel("欢迎登陆图书管理系统");
// 字体
private Font font = new Font("宋体", Font.BOLD, 70);
private Font font2 = new Font("宋体", Font.BOLD, 20);
private Container con = getContentPane();
public MainInterface(String user) {
// 改变窗口图标
Toolkit t = Toolkit.getDefaultToolkit();
Image image = t.getImage("img\\top.jpg");
setIconImage(image);
// 改变背景图片
Icon i = new ImageIcon("img\\Main.jpg");
JLabel Label = new JLabel(i);
Label.setBounds(0, 0, 1200, 800);
jPanel.setLayout(null);
jLabel.setFont(font);
jLabel.setBounds(230, 50, 1000,200);
jLabel.setForeground(Color.yellow);
jPanel.add(jLabel);
jPanel.add(Label);
jTabbedPane.setFont(font2);
jTabbedPane.add("主 界 面", jPanel);
BookSearch search = new BookSearch();
jTabbedPane.add("图书查询",search.jLayeredPane);
BorrowingReturning returning = new BorrowingReturning();
returning.setUser(user);
returning.setModel(search.model);
jTabbedPane.add("图书借还", returning.jLayeredPane);
if(Landing.sureadmin(user)) {
Admin admin = new Admin();
admin.setUser(user);
admin.setFrame(this);
jTabbedPane.add("账户管理", admin.jPanel2);
BookAdmin bookAdmin = new BookAdmin();
bookAdmin.setModel(search.model);
jTabbedPane.add("图书管理",bookAdmin.jPanel2);
}else {
AccountManagement management = new AccountManagement();
management.setUser(user);
management.setFrame(this);
jTabbedPane.add("账户管理", management.jPanel2);
}
con.add(jTabbedPane);
// 不可以改变窗体的大小
setResizable(false);
setTitle("图书管理系统");
setSize(1200, 800);
setLocationRelativeTo(null);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}