Need help I'm new

Need help I'm new

Hi I'm new to processing and programming. Now I have several images that I want to be able to click and cycle though them. 1st I tried the 
      image(name, x,y);
      if(mousePressed){
       image(name2,x,y)


So, this one works but once I release my mouse it takes me back to the 1st image. I then tried the background(); giving me the same problem. Thanks in advanced.