文件名称:java 一手画方一手画圆 多线程
文件大小:4KB
文件格式:TXT
更新时间:2013-06-17 15:28:02
Java 画 方圆
import java.applet.*; import java.awt.*; import java.awt.event.*; public class fangyuan extends Applet implements Runnable { Thread left,right; Graphics mypen; int x,y,z,a,b,i; public void init() { left=new Thread(this); right=new Thread(this); x=10; y=10; mypen=getGraphics(); } public void start() { left.start(); right.start(); } public void run() { while(true) if (Thread.currentThread()==left) { x=x+10; if(x>360) x=10; mypen.setColor(Color.blue); mypen.drawArc(50,50,100,100,x,10); try{left.sleep(200);} catch(InterruptedException e){} }