-
Notifications
You must be signed in to change notification settings - Fork 0
/
Loading.java
44 lines (37 loc) · 956 Bytes
/
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
package Project;
import javax.swing.*;
public class Loading extends JDialog {
private JLabel loadingLabel;
private Timer timer;
private int doCount;
public Loading(JFrame parent) {
super(parent, "GB.GG", true);
loadingLabel = new JLabel("로딩 중.");
add(loadingLabel);
setSize(200, 100);
setLocationRelativeTo(parent);
setResizable(false);
doCount = 0;
timer = new Timer(500, e -> {
updateLoadingLabel();
});
timer.start();
}
private void updateLoadingLabel(){
doCount++;
if(doCount >3){
doCount = 0;
}
String dots = "";
for(int i = 0; i < doCount; i++){
dots += ".";
}
loadingLabel.setText("로딩 중" + dots);
}
public void showLoading() {
setVisible(true);
}
public void hideLoading() {
setVisible(false);
}
}