import java.awt.Graphics;
import java.awt.Color;
import java.awt.Font;

public class GridLineMaker
{
	public void drawGrid( Graphics window )
	{
		// default dimensions
		// TODO: figure out how to get the actual screen size from the Graphics object
		int WIDTH = 800;
		int HEIGHT = 600;
		int maxX = WIDTH - 1;
		int maxY = HEIGHT - 1;

		// save current pen color and font
		Color oldColor = window.getColor();
		Font  oldFont  = window.getFont();

		// draw labels
		window.setColor(Color.BLACK);
		for ( int x=0; x<WIDTH; x+= 50 )
			window.drawString( String.valueOf(x), x, 50 );
		for ( int y=100; y<HEIGHT; y+= 50 )
			window.drawString( String.valueOf(y), 28, y );

		// draw lines
		window.setColor(Color.LIGHT_GRAY);
		for ( int x=0; x<WIDTH; x+=50 )
			window.drawLine(x,0,x,maxY);    // horizontal
		for ( int y=0; y<HEIGHT; y+=50 )
			window.drawLine(0,y,maxX,y);    // vertical

		// restore previous pen color and font
		window.setColor(oldColor);
		window.setFont(oldFont);
	}
}
