Incidentally, it's not a good idea to call g.dispose() at the end of the paint method. Graphics resources are automatically released after the paint method, and disposing of them yourself can bite...