-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimation2.java
More file actions
100 lines (94 loc) · 2.46 KB
/
Animation2.java
File metadata and controls
100 lines (94 loc) · 2.46 KB
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
import javax.swing.*;
import java.awt.*;
public class Animation2 implements Runnable {
private Thread t;
private JLabel label;
private String[] s;
private int bool;
public Animation2(String[] s, int bool){
this.s = s;
this.bool = bool;
}
public void run(){
try{
if(bool == 0){
for(int i = 0; i < s.length; i++){
if(CalculatorFrame.flag5){
if(s[i].equals("END")){
CalculatorFrame.readLabel.setText("END");
break;
}
CalculatorFrame.readLabel.setText(s[i]);
if(!s[i].equals(" "))
CalculatorFrame.parsedLabel.setText(CalculatorFrame.parsedLabel.getText() + s[i]);
Thread.sleep(1000);
}
}
}
if(bool == 1){
for(int i = 0; i < s.length; i++){
if(CalculatorFrame.flag5){
if(s[i] != null){
CalculatorFrame.writtenLabel.setText(CalculatorFrame.writtenLabel.getText()+s[i]);
}
Thread.sleep(1000);
}
}
}
if(bool == 2){
for(int i = 0; i < s.length; i++){
if(CalculatorFrame.flag5){
if(s[i] != null){
CalculatorFrame.statusLabel.setText(s[i]);
}else if(s[i].equals("END")){
CalculatorFrame.statusLabel.setText("END");
break;
}
else{
CalculatorFrame.statusLabel.setText(" ");
}
Thread.sleep(1000);
}
}
}
if(bool == 3){
for(int i = 0; i < s.length; i++){
if(CalculatorFrame.flag5){
if(s[i] != null){
CalculatorFrame.stackLabel.setText(s[i]);
}
Thread.sleep(1000);
}
}
}
if(bool == 4){
for(int i = 0; i < s.length; i++){
if(CalculatorFrame.flag5){
Thread.sleep(300);
if(s[i] != null){
CalculatorFrame.queueLabel.setText(s[i]);
}
Thread.sleep(700);
}
}
}
if(bool == 5){
for(int i = 0; i < s.length; i++){
if(CalculatorFrame.flag5){
Thread.sleep(500);
if(s[i] != null){
CalculatorFrame.arrayLabel.setText(s[i]);
}
Thread.sleep(500);
}
}
}
}catch(Exception e){}
}
public void start(){
if(t == null){
t = new Thread(this);
t.start();
}
}
}