forked from vin8bit/Library-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBookStatus.java
More file actions
171 lines (136 loc) · 3.61 KB
/
Copy pathBookStatus.java
File metadata and controls
171 lines (136 loc) · 3.61 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import java.awt.*;
import javax.swing.*;
import java.sql.*;
import java.io.*;
public class BookStatus extends JFrame
{
String system;
String systempass;
JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12;
JLabel lr1,lr2,lr3,lr4,lr5,lr6,lr7,lr8,lr9,l1r0,lr11,lr12;
ResultSet rs,rs2;
PreparedStatement stm;
Statement stm2;
Connection con;
String up="1";
public BookStatus(String s1)
{
super("Book Status");
up=s1;
setSize(300,400);
setIconImage(new ImageIcon("image/Red_book.png").getImage());
setLayout(null);
setLocation(400,100);
lr1= new JLabel();
lr2= new JLabel();
lr3= new JLabel();
lr4= new JLabel();
lr6= new JLabel();
lr7= new JLabel();
lr8= new JLabel();
lr1.setText("None");
lr2.setText("None");
lr3.setText("None");
lr4.setText("None");
lr6.setText("None");
lr7.setText("None");
lr8.setText("None");
try{
FileInputStream file3=new FileInputStream("username.txt");
byte []by12= new byte[50];
file3.read(by12);
system= new String(by12,0,50);
//System.out.println("2 byte "+user1);
FileInputStream file4=new FileInputStream("password.txt");
byte []by22= new byte[50];
file4.read(by22);
systempass= new String(by22,0,50);
//System.out.println("3 byte "+pass1);
}
catch(IOException io){ }
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe",system,systempass);
stm2=con.createStatement();
rs= stm2.executeQuery("SELECT * FROM book WHERE BOOK_ID="+up+" ");
while(rs.next())
{
lr1.setText(rs.getString(1));
lr2.setText(rs.getString(2));
lr3.setText(rs.getString(3));
lr4.setText(rs.getString(4));
}
con.close();
}
catch(Exception e)
{ }
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe",system,systempass);
stm2=con.createStatement();
rs= stm2.executeQuery("SELECT * FROM issue_book WHERE BOOK_ID1="+up+" ");
while(rs.next())
{
lr6.setText(rs.getString(2));
lr7.setText(rs.getString(3));
lr8.setText(rs.getString(4));
}
}
catch(Exception e)
{ }
JPanel p= new JPanel();
p.setLayout(null);
p.setBounds(0,0,300,400);
JLabel r= new JLabel("Book Status");
Font ft= new Font("Arial Rounded MT",Font.BOLD,15);
r.setFont(ft);
r.setBounds(75,0,200,20);
p.add(r);
l1= new JLabel("Book Id :");
l1.setBounds(20,20,100,20);
p.add(l1);
l2= new JLabel("Book Name :");
l2.setBounds(20,60,100,20);
p.add(l2);
l3= new JLabel("Author :");
l3.setBounds(20,100,100,20);
p.add(l3);
l4= new JLabel("Publisher :");
l4.setBounds(20,140,100,20);
p.add(l4);
l5= new JLabel("Book Issue Details ");
l5.setBounds(20,180,200,20);
Font ft1= new Font("Arial Rounded MT",Font.BOLD,15);
l5.setFont(ft1);
p.add(l5);
l6= new JLabel("User ID :");
l6.setBounds(20,220,100,20);
p.add(l6);
l7= new JLabel("Issue Date :");
l7.setBounds(20,260,100,20);
p.add(l7);
l8= new JLabel("Return Date :");
l8.setBounds(20,300,100,20);
p.add(l8);
lr1.setBounds(150,20,100,20);
p.add(lr1);
lr2.setBounds(150,60,100,20);
p.add(lr2);
lr3.setBounds(150,100,100,20);
p.add(lr3);
lr4.setBounds(150,140,100,20);
p.add(lr4);
lr6.setBounds(150,220,100,20);
p.add(lr6);
lr7.setBounds(150,260,100,20);
p.add(lr7);
lr8.setBounds(150,300,100,20);
p.add(lr8);
add(p);
//setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
}
public static void main(String []args)
{ //new BookStatus();
}
}