-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBanner.java
More file actions
50 lines (41 loc) · 969 Bytes
/
Copy pathBanner.java
File metadata and controls
50 lines (41 loc) · 969 Bytes
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
import java.awt.*;
import java.applet.*;
/*
<applet code="Banner" width=300 height=50>
</applet>
*/
public class Banner extends Applet implements Runnable {
String msg = " Java rules the Web? ";
Thread t;
boolean stopFlag;
public void init() {
t = null;
}
public void start() {
t = new Thread(this);
stopFlag = false;
t.start();
}
public void run() {
for( ; ; ) {
try {
repaint();
Thread.sleep(250);
if(stopFlag)
break;
} catch(InterruptedException exc) {
}
}
}
public void stop() {
stopFlag = true;
t = null;
}
public void paint(Graphics g) {
char ch;
ch = msg.charAt(0);
msg = msg.substring(1, msg.length());
msg += ch;
g.drawString(msg, 50, 30);
}
}