-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgressBarExample.java
89 lines (73 loc) · 2.85 KB
/
ProgressBarExample.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
import java.awt.*;
import javax.swing.*;
//import javax.swing.border.*;
public class ProgressBarExample {
JProgressBar jb;
int i = 0;
ProgressBarExample() {
JFrame f = new JFrame();
//f.setSize(250, 150);
f.setLayout(null);
// f.setLocationRelativeTo(null);
f.getContentPane().setBackground(new Color(255, 255, 255));// white
// f.getContentPane().setBackground(new Color(153, 170, 181)); // light -light-light blue
// f.getContentPane().setBackground(new Color(44, 47, 51));// grey-dicord chat color
// JLabel l1 = new JLabel("", new ImageIcon("D:\\1.gif"), JLabel.CENTER);
JLabel l1 = new JLabel( new ImageIcon(getClass().getResource("/1.gif")));
l1.setBounds(60, 0, 100, 100);
f.add(l1);
// f.getContentPane().setBackground(Color.blue);
l1.setSize(400, 400);
JLabel l2 = new JLabel(new ImageIcon(getClass().getResource("/5.gif")));
l2.setBounds(150, 400, 400, 20);
l2.setSize(200, 200);
f.add(l2);
f.setSize(500, 500);
f.setLayout(null);
f.setVisible(true);
f.setBounds(700, 270, 500, 600);
// f.getContentPane().add(mainPanel); // or whatever...
// f.pack();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jb = new JProgressBar(SwingConstants.VERTICAL, 0, 2000);
jb.setBounds(0, 0, 30, 160);
jb.setValue(0);
jb.setSize(40, 561);
jb.setStringPainted(true);
// Border blackline;
// blackline = BorderFactory.createLineBorder(Color.white);
//jb.setBorder(blackline);
f.add(jb);
//Border blackline;
//blackline,raisedetched, loweredetched,raisedbevel, loweredbevel,
// jb.setBorder(BorderFactory.createLineBorder(Color.CYAN));
// blackline = BorderFactory.createLineBorder(Color.white);
//raisedetched = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
//loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
// raisedbevel = BorderFactory.createRaisedBevelBorder();
//loweredbevel = BorderFactory.createLoweredBevelBorder();
//empty = BorderFactory.createEmptyBorder();
//jb.setBorder(blackline);
// jb.setStringPainted(true);
jb.setForeground(new Color(114, 137, 218));
jb.setBackground(Color.white);
run();
f.setVisible(false);
WelcomePage s = new WelcomePage();
}
public void run() {
while (i <= 2000) {
jb.setValue(i);
i = i + 20;
try {
Thread.sleep(15);
} catch (Exception e) {
}
}
}
}
class as {
public static void main(String[] args) {
new ProgressBarExample();
}
}