-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatistics.java
More file actions
111 lines (93 loc) · 3.48 KB
/
Statistics.java
File metadata and controls
111 lines (93 loc) · 3.48 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
package library.management.system;
import java.awt.*;
import java.sql.*;
import javax.swing.*;
import javax.swing.border.*;
import net.proteanit.sql.DbUtils;
import java.awt.event.*;
public class Statistics extends JFrame{
private JPanel contentPane;
private JTable table;
private JTable table_1;
public static void main(String[] args) {
new Statistics().setVisible(true);
}
public void issueBook() {
try {
conn con = new conn();
String sql = "select * from issueBook";
PreparedStatement st = con.c.prepareStatement(sql);
ResultSet rs = st.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rs));
} catch (Exception e) {
// TODO: handle exception
}
}
public void returnBook() {
try {
conn con = new conn();
String sql = "select * from returnBook";
PreparedStatement st = con.c.prepareStatement(sql);
ResultSet rs = st.executeQuery();
table_1.setModel(DbUtils.resultSetToTableModel(rs));
} catch (Exception e) {
// TODO: handle exception
}
}
public Statistics() {
setBounds(400, 200, 810, 594);
contentPane = new JPanel();
contentPane.setBackground(Color.WHITE);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(40, 51, 708, 217);
contentPane.add(scrollPane);
table = new JTable();
table.setBackground(new Color(224, 255, 255));
table.setForeground(new Color(128, 128, 0));
table.setFont(new Font("Trebuchet MS", Font.BOLD, 15));
scrollPane.setViewportView(table);
JPanel panel = new JPanel();
panel.setBorder(new TitledBorder(new LineBorder(new Color(47, 79, 79), 2, true), "Issue-Book-Details",
TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 128, 128)));
panel.setForeground(new Color(0, 128, 128));
panel.setBounds(26, 36, 737, 240);
panel.setBackground(Color.WHITE);
contentPane.add(panel);
JLabel l1 = new JLabel("Back");
l1.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
setVisible(false);
Home home = new Home();
home.setVisible(true);
}
});
l1.setForeground(new Color(204, 0, 102));
l1.setFont(new Font("Tahoma", Font.BOLD, 18));
ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("library/management/system/icons/tenth.png"));
Image i2 = i1.getImage().getScaledInstance(20, 20, Image.SCALE_DEFAULT);
ImageIcon i3 = new ImageIcon(i2);
l1.setIcon(i3);
l1.setBounds(690, 13, 96, 27);
contentPane.add(l1);
JScrollPane scrollPane_1 = new JScrollPane();
scrollPane_1.setBounds(40, 316, 717, 217);
contentPane.add(scrollPane_1);
table_1 = new JTable();
table_1.setBackground(new Color(204, 255, 255));
table_1.setForeground(new Color(153, 51, 0));
table_1.setFont(new Font("Sitka Small", Font.BOLD, 12));
scrollPane_1.setViewportView(table_1);
JPanel panel_1 = new JPanel();
panel_1.setBorder(new TitledBorder(new LineBorder(new Color(0, 204, 153), 2, true), "Return-Book-Details",
TitledBorder.RIGHT, TitledBorder.TOP, null, new Color(0, 102, 51)));
panel_1.setBounds(22, 299, 741, 240);
panel_1.setBackground(Color.WHITE);
contentPane.add(panel_1);
issueBook();
returnBook();
}
}