📄 screenprotect.java
字号:
import java.applet.Applet;
import java.awt.*;
import java.util.Random;
public class ScreenProtect extends Applet implements Runnable{
int circle_x = 0;//左上角
int circle_y = 0;
int range = 0; //范围
int r = 0; //半径
int ranx= 100;//圆心坐标
int rany = 100;
Color circle_c = Color.WHITE;
Color c = Color.BLUE;
Random rand = new Random();
public void init(){
}
public void start()
{
Thread t = new Thread(this);
t.start();
}
public void update(Graphics g)
{
this.paint(g);
}
public void paint(Graphics g)
{
g.setColor(circle_c);
g.fillOval(circle_x, circle_y, range, range);
}
public void run()
{
while(true){
if(r == 200 || r == 0)
{
circle_c = Color.WHITE;
circle_x = ranx - r/2;
circle_y = rany - r/2;
range = r;
repaint();
ranx = 100 + rand.nextInt(400);
rany = 100 + rand.nextInt(400);
c = new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255));
r = 0;
}
circle_c = c;
circle_x = ranx - r/2;
circle_y = rany - r/2;
range = r;
repaint();
r += 2;
try {
Thread.sleep(10);
}
catch (InterruptedException e)
{
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -