Here you can find the source of drawMovingRect(int x, int y, int width, int height, Graphics g, int seed)
Parameter | Description |
---|---|
x | a parameter |
y | a parameter |
width | a parameter |
height | a parameter |
g | a parameter |
seed | a parameter |
public static void drawMovingRect(int x, int y, int width, int height, Graphics g, int seed)
//package com.java2s; //License from project: Open Source License import java.awt.Color; import java.awt.Graphics; public class Main { /**/*w ww.j ava 2 s. c o m*/ * Draws moving rectangle used for cross and borders in cover * @param x * @param y * @param width * @param height * @param g * @param seed */ public static void drawMovingRect(int x, int y, int width, int height, Graphics g, int seed) { if (width > 1) { for (int i = x, pos = 0; i < x + width; i += 10, pos++) { if (pos % 2 == 0) { g.setColor(Color.black); } else { g.setColor(Color.white); } int z = i + seed + 10; if (z > x + width) { continue; } g.drawLine(i + seed, y, z, y); g.drawLine(i + seed, y + height, z, y + height); } } if (height > 1) { for (int i = y, pos = 0; i < y + height; i += 10, pos++) { if (pos % 2 == 0) { g.setColor(Color.black); } else { g.setColor(Color.white); } int z = i + seed + 10; if (z > y + height) { continue; } g.drawLine(x, i + seed, x, z); g.drawLine(x + width, i + seed, x + width, z); } } } }