Here you can find the source of drawCrosshatch(Graphics2D g, Color color, int left, int right, int top, int height, int spacing, int verticalOffset)
public static void drawCrosshatch(Graphics2D g, Color color, int left, int right, int top, int height, int spacing, int verticalOffset)
//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++; } } }