Java Graphics Draw drawMovingRect(int x, int y, int width, int height, Graphics g, int seed)

Here you can find the source of drawMovingRect(int x, int y, int width, int height, Graphics g, int seed)

Description

Draws moving rectangle used for cross and borders in cover

License

Open Source License

Parameter

Parameter Description
x a parameter
y a parameter
width a parameter
height a parameter
g a parameter
seed a parameter

Declaration

public static void drawMovingRect(int x, int y, int width, int height, Graphics g, int seed) 

Method Source Code

//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);
            }
        }
    }
}

Related

  1. drawISPip(Graphics2D g2d, float width, float height)
  2. drawLightBeamVertical(Graphics g, Color c, int midx, int y1, int y2)
  3. drawLoweredBezel(Graphics g, int x, int y, int w, int h, Color shadow, Color darkShadow, Color highlight, Color lightHighlight)
  4. drawMarker(Graphics2D g, int markerWidth, int markerHeight, Point location)
  5. drawMask(Graphics2D g2, Shape mask)
  6. drawOptimizedLine(Graphics g, int x1, int y1, int x2, int y2)
  7. drawPaintedShape(Graphics2D graphics, Shape shape, Paint paint, Rectangle2D paintBounds, Stroke stroke)
  8. drawPowerScaleLabel(Graphics g, int base, int power, int x, int y, boolean yAxisP)
  9. drawProgressBar(Graphics2D g, final int x, final int y, final int width, final int height, final Color main, final Color progress, final int alpha, final int percentage)