Adding objects to the canvas fom within the mousePressed() method

draw() must exist if you want the code to run continuously, or to process events such as mousePressed() . Sometimes, you might have an empty call to draw() in your program

1 Like