⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datagenerator.java

📁 通过线程控制来打印出julia集
💻 JAVA
字号:
public class DataGenerator implements Runnable {
	int imageWidth, imageHeight, color;

	DataPacket p;

	DataBuffer inputBuffer;

	DataGenerator(int imageWidth, int imageHeight, DataBuffer inputBuffer) {
		this.imageWidth = imageWidth;
		this.imageHeight = imageHeight;
		this.inputBuffer = inputBuffer;
	}

	public void run() {
		while (true) {
			color = 7;					//the highest no. of colors
			p = new DataPacket((int) (imageWidth * Math.random()),	
					(int) (imageHeight * Math.random()), color);
						//chooses a pair of random coordinate swith in the image area
			inputBuffer.put(p);			//put this packet to inputBuffer
			try {
				Thread.sleep(5);		
			} catch (InterruptedException e) {
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -