-
Notifications
You must be signed in to change notification settings - Fork 0
/
Loading.java
69 lines (57 loc) · 1.52 KB
/
Loading.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
package managementSystem;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
public class Loading extends JFrame implements Runnable{
Thread t;
JProgressBar bar;
String username;
public void run() {
try {
for(int i=1;i<=101;i++) {
int max =bar.getMaximum();
int value= bar.getValue();
if(value<max) {
bar.setValue(bar.getValue()+1);
}else {
setVisible(false);
new Dashboard(username);
}
Thread.sleep(50);;
}
}catch(Exception e) {
e.printStackTrace();
}
}
Loading(String username){
this.username =username;
t=new Thread(this);
setBounds(500,200,650,400);
getContentPane().setBackground(Color.WHITE);
setLayout(null);
JLabel text = new JLabel("Travel and Tourism Application");
text.setBounds(50, 20, 600, 40);
text.setForeground(Color.BLUE);
text.setFont(new Font("Raleway",Font.BOLD,35));
add(text);
bar = new JProgressBar();
bar.setBounds(150, 100, 300, 35);
bar.setStringPainted(true);
add(bar);
JLabel loading = new JLabel("Loading Please Wait...");
loading.setBounds(200, 130, 170, 30);
loading.setForeground(Color.RED);
loading.setFont(new Font("Raleway",Font.BOLD,16));
add(loading);
JLabel lblusername = new JLabel("Welcome "+ username);
lblusername.setBounds(20, 310, 400, 40);
lblusername.setForeground(Color.RED);
lblusername.setFont(new Font("Raleway",Font.BOLD,16));
add(lblusername);
t.start();
setVisible(true);
}
public static void main(String[] args) {
new Loading("");
}
}