-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewLibrarian.java
More file actions
105 lines (85 loc) · 2.33 KB
/
Copy pathViewLibrarian.java
File metadata and controls
105 lines (85 loc) · 2.33 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
package com.lirarymanagmenet;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashMap;
import java.util.Map.Entry;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.JTableHeader;
public class ViewLibrarian implements ActionListener
{
LibrarianDetails libDetails;
static HashMap<String ,LibrarianEmployee> map ;
JButton buttonBack;
JFrame frame;
JPanel panel;
JLabel label;
JTable tableView;
JTableHeader tableHeader;
JScrollPane scroller;
public ViewLibrarian()
{
firstFrame();
}
public void firstFrame()
{
frame = new JFrame("Library Management System");
panel = new JPanel();
label = new JLabel();
libDetails = new LibrarianDetails();
map = libDetails.takeAddressHashMap();
tableView = new JTable(map.size(), 6);
scroller = new JScrollPane(tableView);
frame.getContentPane();
tableView.setBounds(10,10,470,180);
tableView.setVisible(true);
int row = 0;
System.out.println(map);
String colname[];
for(Entry<String , LibrarianEmployee> objValues : map.entrySet())
{
String values = objValues.getValue().toString();
colname = values.split(" ");
System.out.println(colname.length);
for(int i = 0; i < colname.length ; i++)
{
System.out.println(colname[i]);
tableView.setValueAt(colname[i], row, i);
}
row++;
}
frame.getContentPane();
buttonBack = new JButton("Back");
buttonBack.setBounds(170, 220, 200, 30);
panel.add(tableView);
panel.setLayout(null);
panel.add(label);
panel.add(buttonBack);
panel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
buttonBack.addActionListener(this);
frame.add(panel);
frame.setLocation(500, 200);
frame.setSize(500, 300);
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
frame.setVisible(true);
}
protected void setTableView()
{
}
public void actionPerformed(ActionEvent ev)
{
// libDetails = new LibrarianDetails();
//map = libDetails.takeAddressHashMap();
new AdminSection();
frame.dispose();
/*
* for(Map.Entry<String, LibrarianEmployee> entry : map.entrySet()) {
* tableView.setValueAt(entry.getKey(), row,0); row++; }
*/
}
}