#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <磨巧扮dos.h>
int main(void)
{
int gdriver = DETECT, gmode, errorcode
int midx, midy,a,b
int radius = 100
initgraph(&gdriver, &gmode, "瞎灶")
errorcode = graphresult()
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode))
printf("Press any key to halt:")
getch()
exit(1)
}
midx = getmaxx() / 2
midy = getmaxy() / 2
setcolor(getmaxcolor())
for(a=0,b=0a<midx,b<宽早midya++,b++)
{circle(a, b, radius)
cleardevice()
delay(500)
}
getch()
closegraph()
return 0
}
public void paintComponent(Graphics g) {super.paintComponents(g)
……
y += 5
}
private class PaintThread implements Runnable {
public void run() {
while(true) {
repaint()
try {
Thread.sleep(100)
} catch (InterruptedException e) {
e.printStackTrace()
}
}
}
public static void main(String[] args){
new Thread(new PaintThread()).start()
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)