-
Notifications
You must be signed in to change notification settings - Fork 5
/
ViewBookedHotel.java
176 lines (138 loc) · 5.58 KB
/
ViewBookedHotel.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
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
172
173
174
175
176
package travel_and_Tourism_Organisation_System;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.awt.BorderLayout;
import java.awt.*;
import java.awt.EventQueue;
import javax.swing.border.EmptyBorder;
import java.awt.Font;
import java.awt.Image;
import java.sql.*;
import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class ViewBookedHotel extends JFrame {
private JPanel contentPane;
Choice c1;
static String username;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
ViewBookedHotel frame = new ViewBookedHotel(username);
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public ViewBookedHotel(String username) {
this.username = username;
setBounds(340, 120, 850, 550);
contentPane = new JPanel();
setContentPane(contentPane);
contentPane.setLayout(null);
ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("travel_and_Tourism_Organisation_System/icons/bookedDetails.jpg"));
Image i3 = i1.getImage().getScaledInstance(500, 350,Image.SCALE_DEFAULT);
ImageIcon i2 = new ImageIcon(i3);
JLabel la1 = new JLabel(i2);
la1.setBounds(450,50,350,350);
add(la1);
JLabel lblName = new JLabel("VIEW BOOKED HOTEL DETAILS");
lblName.setFont(new Font("Yu Mincho", Font.PLAIN, 20));
lblName.setBounds(88, 11, 350, 53);
contentPane.add(lblName);
JLabel lb3 = new JLabel("Username :");
lb3.setBounds(35, 70, 200, 14);
contentPane.add(lb3);
JLabel l1 = new JLabel();
l1.setBounds(271, 70, 200, 14);
contentPane.add(l1);
JLabel lblId = new JLabel("Name :");
lblId.setBounds(35, 110, 200, 14);
contentPane.add(lblId);
JLabel l2 = new JLabel();
l2.setBounds(271, 110, 200, 14);
contentPane.add(l2);
JLabel lb2 = new JLabel("Number of Persons :");
lb2.setBounds(35, 150, 200, 14);
contentPane.add(lb2);
JLabel l3 = new JLabel();
l3.setBounds(271, 150, 200, 14);
contentPane.add(l3);
JLabel lblName_1 = new JLabel("Number of Days :");
lblName_1.setBounds(35, 190, 200, 14);
contentPane.add(lblName_1);
JLabel l4 = new JLabel();
l4.setBounds(271, 190, 200, 14);
contentPane.add(l4);
JLabel lblGender = new JLabel("AC / Non-AC :");
lblGender.setBounds(35, 230, 200, 14);
contentPane.add(lblGender);
JLabel l5 = new JLabel();
l5.setBounds(271, 230, 200, 14);
contentPane.add(l5);
JLabel lblCountry = new JLabel("Food Included (Yes/No) :");
lblCountry.setBounds(35, 270, 200, 14);
contentPane.add(lblCountry);
JLabel l6 = new JLabel();
l6.setBounds(271, 270, 200, 14);
contentPane.add(l6);
JLabel lblReserveRoomNumber = new JLabel("ID :");
lblReserveRoomNumber.setBounds(35, 310, 200, 14);
contentPane.add(lblReserveRoomNumber);
JLabel l7 = new JLabel();
l7.setBounds(271, 310, 200, 14);
contentPane.add(l7);
JLabel lblCheckInStatus = new JLabel("Number :");
lblCheckInStatus.setBounds(35, 350, 200, 14);
contentPane.add(lblCheckInStatus);
JLabel l8 = new JLabel();
l8.setBounds(271, 350, 200, 14);
contentPane.add(l8);
JLabel lblDeposite = new JLabel("Phone :");
lblDeposite.setBounds(35, 390, 200, 14);
contentPane.add(lblDeposite);
JLabel l9 = new JLabel();
l9.setBounds(271, 390, 200, 14);
contentPane.add(l9);
JLabel la2 = new JLabel("Cost :");
la2.setBounds(35, 430, 200, 14);
contentPane.add(la2);
JLabel l10 = new JLabel();
l10.setBounds(271, 430, 200, 14);
contentPane.add(l10);
Conn c = new Conn();
try{
ResultSet rs = c.s.executeQuery("select * from bookhotel where username = '"+username+"'");
while(rs.next()){
l1.setText(rs.getString(1));
l2.setText(rs.getString(2));
l3.setText(rs.getString(3));
l4.setText(rs.getString(4));
l5.setText(rs.getString(5));
l6.setText(rs.getString(6));
l7.setText(rs.getString(7));
l8.setText(rs.getString(8));
l9.setText(rs.getString(9));
l10.setText(rs.getString(10));
}
rs.close();
}catch(SQLException e){}
JButton btnExit = new JButton("Back");
btnExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setVisible(false);
}
});
btnExit.setBounds(160, 470, 120, 30);
btnExit.setBackground(Color.BLACK);
btnExit.setForeground(Color.WHITE);
contentPane.add(btnExit);
getContentPane().setBackground(Color.cyan);
}
}