📄 threadappletdemo2.java
字号:
/**
*Another simple thread program with applet(or shpuld I say a simple applet program with thread?:))
*I have some doubt on the output!
*2004.12.23. xhcprince
*/
import java.lang.*;
import java.applet.*;
import java.awt.*;
public class threadAppletDemo2 extends Applet
{
private byte s;
private boolean flag;
private Font f;
public void start()
{
s = 10;
flag = false;
}
public void paint(Graphics g)
{
f = new Font("Arial",Font.BOLD,s);
setFont(f);
g.drawString("Sincerity",50,50);
if(s < 60)
flag = true;
else if(s == 10)
flag = false;
if(flag)
s -= 5;
else
s += 5;
try
{
Thread.sleep(1000);
}
catch(InterruptedException e)
{
System.out.println(e.getMessage());
}
repaint(); //useless???
}
}
/*
<applet code = "threadAppletDemo2.class" width = 600 height = 160>
</applet>
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -