I am trying to create a Cartesian Grid using a for loop. Below is part of my code so far; when I run it, it does not make a series of lines, but rather it produces a window that has what appears to be a white panel and it slows down my computer considerably. In fact, I have to start task manager and End Task it, because it won't even close normally.
public void paintComponent(Graphics g)
{
int width = getWidth();
int height = getHeight();
super.paintComponent(g);
int xstart=0;
for(int i = 1; i <= 10; i = i++)
{
xstart = i*(width/10);
g.drawLine(xstart, 0, xstart, height);
}
}