That's not the way
you should be doing it... how long does that code take to generate a fractal? paintComponent() gets called every time a component repaints... and until the method exits the entire repaint operation is hung and the program can't respond to any events. In this case what you probably want to do is paint to a BufferedImage and then just draw that image on the component in paintComponent(). You are probably going to want to paint to the image in another
thread because generating a fractal could take a while.
Another thing to point out - if you are using integers (which I am assuming you are because I don't see any casts) that fractal drawing code will probably never exit (at least with all the values I'm trying it with). Integer division will produce results that ignore remainders and you will never increment or decrement values. For this to work you're going to have to use floats or doubles to get real values, and then round x and y when you use them to paint.
I'll try to post some code later that shows how to draw to a BufferedImage instead of the component itself, and updates it using another thread.