-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibrarianSection.java
More file actions
141 lines (111 loc) · 3.18 KB
/
Copy pathLibrarianSection.java
File metadata and controls
141 lines (111 loc) · 3.18 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
136
137
138
139
140
141
package com.lirarymanagmenet;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashMap;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
public class LibrarianSection implements ActionListener
{
JFrame frame;
JPanel panel;
JLabel labelTitle;
BookDetails detailsBook;
StudentsDetails detailsStudent;
HashMap<String , BookSeperately> bookHashMap = null;
HashMap<String, StudentSeperately> studentHashMap = null;
JButton addBooks, viewBook, issueBook, viewIssuedBooks, returnBook, logout;
public LibrarianSection()
{
frame = new JFrame("Library Management System");
panel = new JPanel();
labelTitle = new JLabel("Library Section");
labelTitle.setForeground(Color.black);
labelTitle.setFont(new Font("Tahoma", Font.PLAIN, 13) );
labelTitle.setBounds(20 ,0,100, 40);
labelTitle.setVisible(true);
frame.getContentPane();
addBooks = new JButton("Add Books");
addBooks.setBounds(170, 20, 200, 30);
viewBook = new JButton("View Books");
viewBook.setBounds(170, 60, 200, 30);
issueBook = new JButton("Issue Book");
issueBook.setBounds(170, 100, 200, 30);
viewIssuedBooks = new JButton("View Issued Book");
viewIssuedBooks.setBounds(170, 140, 200, 30);
returnBook = new JButton("Return Book");
returnBook.setBounds(170, 180, 200, 30);
logout = new JButton("Logout");
logout.setBounds(170, 220, 200, 30);
panel.setLayout(null);
panel.add(labelTitle);
panel.add(addBooks);
panel.add(viewBook);
panel.add(issueBook);
panel.add(viewIssuedBooks);
panel.add(returnBook);
panel.add(logout);
panel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
addBooks.addActionListener(this);
viewBook.addActionListener(this);
issueBook.addActionListener(this);
viewIssuedBooks.addActionListener(this);
returnBook.addActionListener(this);
logout.addActionListener(this);
frame.add(panel);
frame.setLocation(500, 200);
frame.setSize(500, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
detailsBook = new BookDetails();
bookHashMap = detailsBook.takeAddressOfBookHash();
detailsStudent = new StudentsDetails();
studentHashMap = detailsStudent.takeAddressStudentDetails();
if(e.getSource() == addBooks) {
frame.dispose();
new AddBooks();
}
else if(e.getSource() == viewBook) {
if(bookHashMap != null)
{
new ViewBook();
frame.dispose();
}
else
{
JOptionPane.showMessageDialog(null, "Book List is Empty!!!");
}
}
else if(e.getSource() == issueBook) {
new IssueBook();
frame.dispose();
}
else if(e.getSource() == viewIssuedBooks) {
if(studentHashMap != null)
{
new ViewIssueBooks();
frame.dispose();
}
else
{
JOptionPane.showMessageDialog(null, "No Books is Issued Yet!!!");
}
}
else if(e.getSource() == returnBook) {
new ReturnBook();
frame.dispose();
}
else {
new Logout();
frame.dispose();
}
}
}