📄 oneall.java
字号:
//<applet code=NewOne width=700 height=400></applet>
import java.awt.*;
import java.applet.*;
import java.util.*;
public class OneAll extends Applet{
int x0,y0,x1,y1;
int width,height;
int dgree;
int length;
int sleeptime;
public void init(){
sleeptime=100; //一笔画后的停留时间
dgree=15; //分点数
x0=100; //左边中点坐标
y0=200;
width=dgree*25; //长方形边长
height=200; //长方形高
x1=x0+width;
y1=y0;
length=width/dgree;//每一小段长度
this.resize(600,600);
this.setBackground(Color.black);
}
public void paint(Graphics g){
g.setColor(Color.green);
if(dgree%2!=0)
for(int i=0;i<=width;i+=length){
g.drawLine(x0, y0, x0+i, y0-height/2);
try{
Thread.sleep(sleeptime);
}
catch(InterruptedException e){
}
g.drawLine(x0+i, y0-height/2,x1,y1);
try{
Thread.sleep(sleeptime);
}
catch(InterruptedException e){
}
g.drawLine(x1,y1,x0+i,y0+height/2);
try{
Thread.sleep(sleeptime);
}
catch(InterruptedException e){
}
g.drawLine(x0+i,y0+height/2,x0,y0);
try{
Thread.sleep(sleeptime);
}
catch(InterruptedException e){
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -