how to take input From Mouse in Java Processing


PImage img;
int rec,ellps=0;
void setup()
{
size(200,200);

background(156,45,0);
//fill(0);
//rect(20,20,width/2,height/2);

}




/*

################################################
   
   
                drawEllips()  function


################################################

*/




void drawEllips()
{
  background(6,45,0);
fill(0);
ellipse(width/2,height/2,150,150);

}


/*

################################################
   
   
                DrawRect()  function


################################################

*/

void DrawRect()
{
 
background(156,0,50);
fill(255);
rect(20,20,width/2,height/2);

}

void mousePressed()                //  mouse Press Function

{
//rec++;
if(rec>=3)

rec=0;



if(rec==0||rec<3)
{
  rec++;
}
}
void draw()
{

if(rec==1)
{
drawEllips();

}

if(rec==2)
{
DrawRect();

}
}