-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainCell.java
86 lines (76 loc) · 2.12 KB
/
MainCell.java
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
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class MainCell implements ActionListener
{
JFrame jf;
JPanel jp;
JButton adst,login,adbk,stat_book,admlout;
JLabel wel;
MainCell(String adm)
{
jf=new JFrame("Library Management System", null);
jp=new JPanel(new GridBagLayout());
adbk=new JButton("Add Book", null);
stat_book=new JButton("Book Status", null);
adst=new JButton("Add Student", null);
login=new JButton("Log In", null);
admlout=new JButton("Admin Log Out", null);
wel=new JLabel("<html>Welcome to Library Management<br> Admin : "+adm+"</html>", null, 0);
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = new Insets(5, 5, 5, 5);
gbc.ipadx = 50;
gbc.ipady = 30;
adst.addActionListener(this);
login.addActionListener(this);
adbk.addActionListener(this);
stat_book.addActionListener(this);
admlout.addActionListener(this);
gbc.gridx=0;
gbc.gridy=0;
gbc.gridwidth=5;
jp.add(wel,gbc);
gbc.gridx=0;
gbc.gridy=1;
gbc.gridwidth=1;
jp.add(adst,gbc);
gbc.gridx++;
jp.add(login,gbc);
gbc.gridx++;
jp.add(adbk,gbc);
gbc.gridx++;
jp.add(stat_book,gbc);
gbc.gridx++;
jp.add(admlout,gbc);
jf.add(jp);
jf.setSize(900, 500);
jf.setVisible(true);
jf.setBackground(Color.DARK_GRAY);
jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
public void actionPerformed(ActionEvent ae)
{
String s=ae.getActionCommand();
if(s=="Add Student")
{
new AddSt();
}
else if(s=="Log In")
{
new Login();
}
else if(s=="Add Book")
{
new Add_Book();
}
else if(s=="Book Status")
{
new Bk_Status();
}
else if(s=="Admin Log Out")
{
jf.dispose();
}
}
}