-
Notifications
You must be signed in to change notification settings - Fork 0
/
CheckHotels.java
67 lines (52 loc) · 1.91 KB
/
CheckHotels.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
package managementSystem;
import javax.swing.*;
import java.awt.*;
import java.sql.*;
import java.awt.event.*;
public class CheckHotels extends JFrame implements Runnable{
Thread t1;
JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10;
JLabel[] label = new JLabel[] {l1,l2,l3,l4,l5,l6,l7,l8,l9,l10};
JLabel caption;
public void run() {
String[] text= new String[] {"JW Marriot Hotel","Madarin Hotel","Four Season Hotel","Radisson Hotel","Great Grand ITC","Classio Hotel","The Bay Club Hotel","Breeze Blow Hotel","The Taj Hotel","Happy Morning Hotel"};
try {
for(int i = 0;i<=9;i++) {
label[i].setVisible(true);
caption.setText(text[i]);
Thread.sleep(2500);
label[i].setVisible(false);
}
}catch(Exception e) {
e.printStackTrace();
}
}
CheckHotels(){
setBounds(400,100,800,600);
caption= new JLabel();
caption.setBounds(50,500,1000,70);
caption.setFont(new Font("Tahoma",Font.PLAIN,40));
caption.setForeground(Color.WHITE);
add(caption);
ImageIcon i1=null,i2=null,i3=null,i4=null,i5=null,i6=null,i7=null,i8=null,i9=null,i10=null;
ImageIcon[] image= new ImageIcon[] {i1,i2,i3,i4,i5,i6,i7,i8,i9,i10};
Image j1=null,j2=null,j3=null,j4=null,j5=null,j6=null,j7=null,j8=null,j9=null,j10=null;
Image[] jimage= new Image[] {j1,j2,j3,j4,j5,j6,j7,j8,j9,j10};
ImageIcon k1=null,k2=null,k3=null,k4=null,k5=null,k6=null,k7=null,k8=null,k9=null,k10=null;
ImageIcon[] kimage= new ImageIcon[] {k1,k2,k3,k4,k5,k6,k7,k8,k9,k10};
for(int i=0;i<=9;i++) {
image[i] = new ImageIcon(ClassLoader.getSystemResource("icons/hotel"+(i+1)+".jpg"));
jimage[i]= image[i].getImage().getScaledInstance(900, 600, Image.SCALE_DEFAULT);
kimage[i]= new ImageIcon(jimage[i]);
label[i] = new JLabel(kimage[i]);
label[i].setBounds(0,0,800,600);
add(label[i]);
}
t1= new Thread(this);
t1.start();
setVisible(true);
}
public static void main(String[] args) {
new CheckHotels();
}
}