-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewPackage.java
129 lines (95 loc) · 3.71 KB
/
ViewPackage.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
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
package TravelingSystem;
import javax.swing.*;
import java.awt.*;
import java.sql.*;
import java.awt.event.*;
public class ViewPackage extends JFrame implements ActionListener{
JButton back;
ViewPackage(String username){
setBounds(450,200,900,450);
getContentPane().setBackground(Color.WHITE);
setLayout(null);
JLabel text=new JLabel("View Package Details");
text.setFont(new Font("Tahoma",Font.BOLD,16));
text.setBounds(60,0,300,30);
add(text);
JLabel lblusername=new JLabel("Username");
lblusername.setBounds(30,50,150,25);
add(lblusername);
JLabel labelusername=new JLabel();
labelusername.setBounds(220,50,150,25);
add(labelusername);
JLabel lblpackage=new JLabel("Package");
lblpackage.setBounds(30,90,150,25);
add(lblpackage);
JLabel labelpackage=new JLabel();
labelpackage.setBounds(220,90,150,25);
add(labelpackage);
JLabel lblpersons=new JLabel("Total Persons");
lblpersons.setBounds(30,130,150,25);
add(lblpersons);
JLabel labelpersons=new JLabel();
labelpersons.setBounds(220,130,150,25);
add(labelpersons);
JLabel lblid=new JLabel("Id");
lblid.setBounds(30,170,150,25);
add(lblid);
JLabel labelid=new JLabel();
labelid.setBounds(220,170,150,25);
add(labelid);
JLabel lblnumber=new JLabel("Number");
lblnumber.setBounds(30,210,150,25);
add(lblnumber);
JLabel labelnumber=new JLabel();
labelnumber.setBounds(220,210,150,25);
add(labelnumber);
JLabel lblphone=new JLabel("Phone");
lblphone.setBounds(30,250,150,25);
add(lblphone);
JLabel labelphone=new JLabel();
labelphone.setBounds(220,250,150,25);
add(labelphone);
JLabel lblprice=new JLabel("Price");
lblprice.setBounds(30,290,150,25);
add(lblprice);
JLabel labelprice=new JLabel();
labelprice.setBounds(220,290,150,25);
add(labelprice);
back=new JButton("Back");
back.setBackground(Color.BLACK);
back.setForeground(Color.WHITE);
back.setBounds(130,360,100,50);
back.addActionListener(this);
add(back);
ImageIcon I1=new ImageIcon(ClassLoader.getSystemResource("icons/bookedDetails.jpg"));
Image I2=I1.getImage().getScaledInstance(500,400,Image.SCALE_DEFAULT);
ImageIcon I3=new ImageIcon(I2);
JLabel image=new JLabel(I3);
image.setBounds(450,20,500,400);
add(image);
try{
Conn c=new Conn();
String query="select *from bookpackage where username = '"+username+"'";
ResultSet rs=c.s.executeQuery(query);
while(rs.next()){
labelusername.setText(rs.getString("username"));
labelid.setText(rs.getString("id"));
labelnumber.setText(rs.getString("number"));
labelpackage.setText(rs.getString("package"));
labelprice.setText(rs.getString("price"));
labelphone.setText(rs.getString("phone"));
labelpersons.setText(rs.getString("persons"));
}
}catch(Exception e){
}
setVisible(true);
}
public void actionPerformed(ActionEvent ae){
setVisible(false);
}
public static void main(String [] args){
new ViewPackage("Anshu123");
}
{
{
}