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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
| package appletjava;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JApplet;
import javax.swing.JButton;
public class AppletJava extends JApplet {
Image image = null;
BufferedImage bufferedImage = null;
int WIDTH = 600;
int HEIGHT = 600;
int accesPaint = 0;
boolean startFThread = false;
boolean startSThread = false;
boolean startTThread = false;
JButton ControllFThread = new JButton("Start First Thread");
JButton ControllSThread = new JButton("Start Second Thread");
JButton ControllTThread = new JButton("Start Third Thread");
Thread FThread = new Thread(new Runnable() {
@Override
public void run() {
while(startFThread == true){
accesPaint++;
System.out.println("asdas");
repaint();
if(accesPaint == 10)
{
accesPaint = 0;
}
}
}});
Thread SThread = new Thread(new Runnable() {
@Override
public void run() {
}
});
Thread TThread = new Thread(new Runnable() {
@Override
public void run() {
}
});
@Override
public void init(){
resize(WIDTH, HEIGHT);
setLayout(null);
ControllFThread.setBounds(40, 570, 160, 30);
add(ControllFThread);
ControllSThread.setBounds(210, 570, 160, 30);
add(ControllSThread);
ControllTThread.setBounds(380, 570, 160, 30);
add(ControllTThread);
ControllFThread.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
КНОПКА ДЛЯ ПУСКА Thread
if(!FThread.isAlive()){
FThread.start();
}
if(startFThread == false){
startFThread = true;
FThread.resume();
}
else if (startFThread == true){
startFThread = false;
FThread.suspend();
}
}
});
ControllSThread.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if(startSThread == false)
startSThread = true;
else
startSThread = false;
}
});
ControllTThread.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if(startTThread == false)
startTThread = true;
else
startTThread = false;
}
});
}
@Override
public void update(Graphics g){
paint(g);
}
@Override
public void paint(Graphics g){
System.out.println(accesPaint);
//Draw monitor
g.setColor(Color.BLACK);
g.fillRect(20, 20, 560, 300);
g.setColor(Color.black);
//Draw leg
g.fillRect(280,320,40,70);
//Draw support
g.fillRect(240, 390, 120, 20);
g.fillRect(29, 29, 541, 281);
g.setColor(Color.LIGHT_GRAY);
g.fillRect(30, 30, 540, 280);
g.fillOval(280, 22, 6, 6);
g.setColor(Color.black);
g.fillOval(281, 23, 4, 4);
g.setColor(Color.red);
g.fillOval(292, 24, 3, 3);
g.setColor(Color.GREEN);
g.fillOval(572, 280, 5, 5);
g.setColor(Color.blue);
g.fillRect(30, 303, 540, 7);
//Cancel draw monitor
//Draw Console
g.setColor(Color.black);
g.drawRect(290, 60, 200, 235);
g.setColor(Color.DARK_GRAY);
g.fillRect(291, 61, 199, 234);
g.setColor(Color.blue);
g.fillRect(290, 60, 201, 10);
//Draw Console contain
if(accesPaint <1 ){
g.setFont(new Font("Arial", Font.PLAIN,9));
g.setColor(Color.red);
g.drawString("@root~Student:", 290, 84);
g.setColor(Color.GREEN);
System.out.println("is painting else");
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
Logger.getLogger(AppletJava.class.getName()).log(Level.SEVERE, null, ex);
}
}
if(accesPaint < 2){
g.drawString("sudo getInfo -w -r ", 358, 84);
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
Logger.getLogger(AppletJava.class.getName()).log(Level.SEVERE, null, ex);
}
}
if(accesPaint < 3){
g.drawString("====================================",300,100);
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
Logger.getLogger(AppletJava.class.getName()).log(Level.SEVERE, null, ex);
}
}
if(accesPaint < 4){
g.setFont(new Font("Arial", Font.BOLD, 20));
g.drawString("F C I M",340,120);
g.setFont(new Font("Arial", Font.PLAIN,9));
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
Logger.getLogger(AppletJava.class.getName()).log(Level.SEVERE, null, ex);
}
}
if(accesPaint < 5){
g.drawString("====================================",300,130);
g.setColor(Color.WHITE);
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
Logger.getLogger(AppletJava.class.getName()).log(Level.SEVERE, null, ex);
}
}
if(accesPaint < 6){
g.drawString("Decan:",300,140);
g.drawString("Ion Balmus", 380, 140);
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
Logger.getLogger(AppletJava.class.getName()).log(Level.SEVERE, null, ex);
}
}
if(accesPaint < 7){
g.drawString("Pro-Decan:",300,150);
g.drawString("Radu Melnic", 380, 150);
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
Logger.getLogger(AppletJava.class.getName()).log(Level.SEVERE, null, ex);
}
}
if(accesPaint < 8){
g.drawString("Specialitati:",300,170);
g.setColor(Color.CYAN);
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
Logger.getLogger(AppletJava.class.getName()).log(Level.SEVERE, null, ex);
}
}
if(accesPaint < 9){
g.drawString("Calculatoare,Informatica,", 380, 170);
g.drawString("Management Informationa,", 380, 180);
g.drawString("Informatica Aplicata,", 380, 190);
g.drawString("Microelectronica ?i", 380, 200);
g.drawString("nanotehnologii,", 380, 210);
g.drawString("Tehnologii informationale,", 380, 220);
g.drawString("Automatica si informatica,", 380, 230);
g.drawString("Ingineria sistemelor ", 380, 240);
g.drawString("biomedicale,", 380, 250);
g.drawString("Securitatea informa?ionala,", 380, 260);
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
Logger.getLogger(AppletJava.class.getName()).log(Level.SEVERE, null, ex);
}
}
if(accesPaint < 10){
g.setColor(Color.red);
g.drawString("@root~Student:", 380, 84);
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
Logger.getLogger(AppletJava.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
} |