How to use this code with mousePressed?

Hey There!

There is a void mousePressed method within processing !

https://processing.org/reference/mousePressed_.html