Java Graphics Draw drawCrosshatch(Graphics2D g, Color color, int left, int right, int top, int height, int spacing, int verticalOffset)

Here you can find the source of drawCrosshatch(Graphics2D g, Color color, int left, int right, int top, int height, int spacing, int verticalOffset)

Description

draw Crosshatch

License

Open Source License

Declaration

public static void drawCrosshatch(Graphics2D g, Color color, int left,
            int right, int top, int height, int spacing, int verticalOffset) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.*;

public class Main {
    public static void drawCrosshatch(Graphics2D g, Color color, int left,
            int right, int top, int height, int spacing, int verticalOffset) {

        g = (Graphics2D) g.create();

        g.clipRect(left + 1, top + 1, right - left - 1, height - 1);

        g.setColor(color);/*from www .jav  a2  s  . c  o m*/

        int x = left - height + 1 - verticalOffset, bottom = top + height;
        int count = 0;
        while (x < right) {

            g.drawLine(x, bottom - 1, x + height, top + 1);
            x += spacing;
            count++;

        }

    }
}

Related

  1. drawCheck(Graphics g, int x, int y)
  2. drawCheckerPattern(Graphics g_, int checkerSize)
  3. drawColors(Color[] colors, Graphics g, int x1, int y1, int x2, int y2, int direction)
  4. drawCoordinateAxes(Graphics2D g, Component comp)
  5. drawCross(Graphics2D g2d, int x, int y, int size)
  6. drawCube(Graphics g, int x, int y, int w, int h, int d, float fac)
  7. drawDiamond(Graphics2D g2d, int xPos, int yPos)
  8. drawDisc(Graphics g)
  9. drawDot(Graphics g, int x, int y)