资 源 简 介
package com.lzw;
import java.awt.*;
import java.util.*;
import javax.swing.*;
public class SleepMethodTest extends JFrame {
private Thread t;
// 定义颜色数组
//setVisible(true); // 使窗体可见
// 设置窗体关闭方式
//setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
private static Color[] color = { Color.orange, Color.BLUE, Color.CYAN,
Color.GREEN, Color.ORANGE, Color.YELLOW, Color.RED,
Color.PINK, Color.LIGHT_GRAY };
private static final Random rand = new Random();// 创建随机对象
private static Color getC() {// 获取随机颜色值的方法
return color[rand.nextInt(color.length)];
}
public SleepMethodTest() {
t = new Thread(new Runnable() {// 创建匿名线程对象
int x = 60;// 定义初始坐标
int y = 60;
int m = 20;
int n = 0;
int r=20;
int R;
public void run() {// 覆盖线程接口方法
while (n++&l