-
Notifications
You must be signed in to change notification settings - Fork 3
/
HotelDisplay.java
306 lines (263 loc) · 9.01 KB
/
HotelDisplay.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
package brivago;
import javax.swing.JScrollPane;
import javax.swing.*;
import javax.imageio.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URL;
import java.util.ArrayList;
class HotelDisplay
{
JFrame frame;
public static void main(String args[]) throws IOException
{
HotelDisplay basetemplate = new HotelDisplay();
basetemplate.gui();
}
ArrayList<String> hotelName = new ArrayList<String>();
ArrayList<String> landmark = new ArrayList<String>();
ArrayList<String> cityName = new ArrayList<String>();
ArrayList<Boolean> wifi = new ArrayList<Boolean>();
ArrayList<Boolean> parking = new ArrayList<Boolean>();
ArrayList<Boolean> restuarant = new ArrayList<Boolean>();
ArrayList<Boolean> ac = new ArrayList<Boolean>();
ArrayList<Boolean> compBreakfast = new ArrayList<Boolean>();
ArrayList<Integer> price1 = new ArrayList<Integer>();
ArrayList<Integer> price2 = new ArrayList<Integer>();
ArrayList<Integer> numberOf1Rooms = new ArrayList<Integer>();
ArrayList<Integer> numberOf2Rooms = new ArrayList<Integer>();
ArrayList<Float> rating = new ArrayList<Float>();
BookingConfirmation bc;
int numberOf1Room, numberOf2Room;
String checkInDate, checkOutDate;
public void gui() throws IOException
{
frame = new JFrame("Brivago");//setting background image
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setSize(1920,1080);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
frame.setContentPane(new JLabel(new ImageIcon("beach.jpg")));
frame.setLayout(null);
ImageIcon brivagoicon = new ImageIcon("brivagoicon.jpg");//setting app icon
frame.setIconImage(brivagoicon.getImage());
JButton profile = new JButton("Profile");//profile button setup
profile.setBounds(1405,10,77,30);
profile.addActionListener(new ProfileListener());
frame.getContentPane().add(profile);
JButton logout = new JButton();//logout button setup
logout.setBounds(1495, 10, 30,30);
frame.getContentPane().add(logout);
logout.addActionListener(new LogoutListener());
ImageIcon image = new ImageIcon("power.jpg");
logout.setIcon(image);
JButton mybook = new JButton("My Bookings");//mybooking button setup
mybook.setBounds(1285,10, 108, 30);
mybook.addActionListener(new BookingListener());
frame.getContentPane().add(mybook);
//for loop starting here---------------------
for(int i=1;i<3;i++) {
JLabel heading = new JLabel(cityName.get(i));
heading.setBounds(550,100,300,60);
Font font = new Font("serif",Font.BOLD + Font.ITALIC,40);
heading.setFont(font);
heading.setForeground(Color.ORANGE);
frame.add(heading);
JPanel panel1=new JPanel();
panel1.setBounds(240,200*(i),840,180);
panel1.setLayout(null);
//String temp = cityName.get(0);
//System.out.println(temp);
JLabel hotelName1 = new JLabel(hotelName.get(i));
hotelName1.setBounds(300,200*(i),300,60);
Font font1 = new Font("serif",Font.BOLD,50);
hotelName1.setFont(font1);
hotelName1.setForeground(Color.BLUE);
JLabel hotel1 = new JLabel("5 star - Hotel");
hotel1.setBounds(300,250+200*(i-1),300,60);
Font font2 = new Font("serif",Font.BOLD,20);
hotel1.setFont(font2);
JLabel city1 = new JLabel(cityName.get(i));
city1.setBounds(300,280+200*(i-1),300,60);
city1.setFont(font2);
JLabel rating1 = new JLabel(Float.toString(rating.get(i)));
rating1.setBounds(300,320+200*(i-1),300,60);
rating1.setFont(font2);
rating1.setForeground(Color.YELLOW);
JLabel price = new JLabel(Integer.toString(price1.get(i)));
price.setBounds(800,200+200*(i-1),300,60);
Font font3 = new Font("serif",Font.BOLD,40);
price.setFont(font3);
price.setForeground(Color.RED);
JLabel temp = new JLabel("Per Night");
temp.setBounds(800,240+200*(i-1),300,60);
temp.setFont(font2);
JButton view1 = new JButton("View Details");//mybooking button setup
Font font4=new Font("serif",Font.BOLD,20);
view1.setBounds(800,320+200*(i-1),200,40);
view1.setBackground(Color.CYAN);
view1.setFont(font4);
frame.add(view1);
final int j = i;
view1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
try {
HotelView hv=new HotelView();
//hv.hd = basetemplate;
hv.numberOf1Room = numberOf1Room;
hv.numberOf2Room = numberOf2Room;
hv.bc = bc;
hv.hotelName1 = hotelName.get(j);
hv.cityName1 = cityName.get(j);
hv.landmark1 = landmark.get(j);
hv.wifi1 = wifi.get(j);
hv.parking1 = parking.get(j);
hv.restuarant1 = restuarant.get(j);
hv.ac1 = ac.get(j);
hv.compBreakfast1 = compBreakfast.get(j);
hv.price11 = price1.get(j);
hv.price21 = price2.get(j);
hv.checkInDate = checkInDate;
hv.checkOutDate = checkOutDate;
hv.gui();}
catch(Exception e1)
{
e1.printStackTrace();
}
}
});
frame.add(hotelName1);
frame.add(hotel1);
frame.add(city1);
frame.add(rating1);
frame.add(price);
frame.add(temp);
panel1.setBackground(new Color(0,60,0,60));
panel1.setBorder(BorderFactory.createLineBorder(Color.BLACK,4));
frame.add(panel1);
}
/*JPanel panel2=new JPanel();
panel2.setBounds(240,400,840,180);
panel2.setLayout(null);
JLabel hotelName2 = new JLabel("Lake Palace");
hotelName2.setBounds(300,400,300,60);
hotelName2.setFont(font1);
hotelName2.setForeground(Color.BLUE);
JLabel hotel2 = new JLabel("7 star - Hotel");
hotel2.setBounds(300,450,300,60);
hotel2.setFont(font2);
JLabel city2 = new JLabel("Jaipur, Rajasthan, India");
city2.setBounds(300,480,300,60);
city2.setFont(font2);
JLabel rating2 = new JLabel("9.3");
rating2.setBounds(300,520,300,60);
rating2.setFont(font2);
rating2.setForeground(Color.YELLOW);
JLabel price2 = new JLabel("Rs. 36000");
price2.setBounds(800,400,300,60);
price2.setFont(font3);
price2.setForeground(Color.RED);
JLabel temp2 = new JLabel("Per Night");
temp2.setBounds(800,440,300,60);
temp2.setFont(font2);
JButton view2 = new JButton("View Details");//mybooking button setup
view2.setBounds(800,520,200,40);
view2.setBackground(Color.CYAN);
view2.setFont(font4);
frame.add(view2);
frame.add(hotelName2);
frame.add(hotel2);
frame.add(city2);
frame.add(rating2);
frame.add(price2);
frame.add(temp2);
panel2.setBackground(new Color(0,60,0,60));
panel2.setBorder(BorderFactory.createLineBorder(Color.BLACK,4));
frame.add(panel2);
JPanel panel3=new JPanel();
panel3.setBounds(240,600,840,180);
panel3.setLayout(null);
JLabel hotelName3 = new JLabel("Radisson Blu");
hotelName3.setBounds(300,600,300,60);
hotelName3.setFont(font1);
hotelName3.setForeground(Color.BLUE);
JLabel hotel3 = new JLabel("4 star - Hotel");
hotel3.setBounds(300,650,300,60);
hotel3.setFont(font2);
JLabel city3 = new JLabel("Jaipur, Rajasthan, India");
city3.setBounds(300,680,300,60);
city3.setFont(font2);
JLabel rating3 = new JLabel("8.1");
rating3.setBounds(300,720,300,60);
rating3.setFont(font2);
rating3.setForeground(Color.YELLOW);
JLabel price3 = new JLabel("Rs. 5000");
price3.setBounds(800,600,300,60);
price3.setFont(font3);
price3.setForeground(Color.RED);
JLabel temp3 = new JLabel("Per Night");
temp3.setBounds(800,640,300,60);
temp3.setFont(font2);
JButton view3 = new JButton("View Details");//mybooking button setup
view3.setBounds(800,720,200,40);
view3.setBackground(Color.CYAN);
view3.setFont(font4);
frame.add(view3);
frame.add(hotelName3);
frame.add(hotel3);
frame.add(city3);
frame.add(rating3);
frame.add(price3);
frame.add(temp3);
panel3.setBackground(new Color(0,60,0,60));
panel3.setBorder(BorderFactory.createLineBorder(Color.BLACK,4));
frame.add(panel3);
/*JPanel panel4=new JPanel();
panel4.setBounds(200,940,1000,200);
panel4.setBackground(Color.gray);
frame.add(panel4);
JPanel panel5=new JPanel();
panel5.setBounds(200,1180,1000,200);
panel5.setBackground(Color.gray);
frame.add(panel5);
*/
/* view1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
try {
HotelView hv=new HotelView();
hv.gui();}
catch(Exception e1)
{
e1.printStackTrace();
}
}
});
view2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
try {
HotelView hv=new HotelView();
hv.gui();}
catch(Exception e1)
{
e1.printStackTrace();
}
}
});
view3.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
try {
HotelView hv=new HotelView();
hv.gui();}
catch(Exception e1)
{
e1.printStackTrace();
}
}
});*/
frame.revalidate();
frame.repaint();
}
}