Also, you should do all your drawing in draw. Consider this simple example:
int w;
void setup(){
size(400,400);
w = 0;
}
void draw(){
if( w == 0 ){
background(255,0,0);
}
if( w == 1 ){
background(0,0,255);
}
}
void mousePressed(){
w = w + 1;
if( w == 2 ){
w = 0;
}
}