Here you can find the source of drawGatter(Graphics g, int xDist, int yDist)
public static void drawGatter(Graphics g, int xDist, int yDist)
//package com.java2s; //License from project: Apache License import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; public class Main { public final static BasicStroke gatterStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, null, 0.0f); public static void drawGatter(Graphics g, int xDist, int yDist) { Graphics2D g2 = (Graphics2D) g; g2.setStroke(gatterStroke);/* w ww . j ava 2 s . c o m*/ g2.setPaint(new Color(230, 230, 230)); for (int x = 0; x < g2.getClipBounds().x + g2.getClipBounds().width; x += xDist) { g2.drawLine(x, 0, x, g2.getClipBounds().y + g2.getClipBounds().height); } for (int y = 0; y < g2.getClipBounds().y + g2.getClipBounds().height; y += yDist) { g2.drawLine(0, y, g2.getClipBounds().x + g2.getClipBounds().width, y); } } }