Need help with generative art

Hello, my name is Matías, i’m from Argentina and this is my first post on this awersome forum.

Today, i’m working with generative art and the problem is that i’m “painting” the background with the mouseX and mouseY positions as if the mouse was a brush and then I need the mouse to stop painting and to do something different in order to finish with the art picture and I don’t now how to do it…
This is the style of picture I want to recreate…
download

In the program what I have done is making a class for the brush that paints the background and then I have done a class that I called “contador” which counts +1 when the mouse moves all over the screen in order to control when the background is already painted. I thought that having that information I would be able to “stop” painting and start with another part of the picture but that is what I can’t do, anyone could help me?

Thanks and cheers from Argentina for everyone!

Here is the link of the program, I couldn’t put it with the code because it has classes and it’s a mess hahaha

sorry, i not read your code,
but your description sounds like you use the mouse position for paint
( and not use the mousePressed )
only to compare with other ideas, pls check recent
Help with a "Drawing" App second code

so you have color adjust and brush size, but no SPRAY tool
possibly you have that already.