📄 testthread4.java
字号:
import java.applet.*;import java.awt.*;
public class TestThread4 extends java.applet.Applet implements Runnable
{ int x=0,y=5; Thread Scrollwords=null;
public void init()
{ setFont(new Font("TimesRoman",Font.BOLD,16));
}
public void start()
{
if(Scrollwords ==null)
{Scrollwords =new Thread(this);
Scrollwords .start();
}
}
public void run ()
{
while(Scrollwords !=null)
{x=x+1;y=y+1;
if(x>200)
x=0;
if(y>100)
y=10;;
repaint();
try{
Scrollwords .sleep(20);
}
catch(InterruptedException e){}
}
}
public void paint(Graphics g)
{g.drawString("Here is big club,welcome to all!",x,y);
}
public void stop()
{Scrollwords.yield();
Scrollwords =null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -