Rectangle button

Hello,

I provided you with example code to help with your coding.
println() and text() can be useful tools.
I also added a line() and circle() to see boundaries.
You could also show dist() as you are moving mouse.

Please format your code as a courtesy to the community:
https://discourse.processing.org/faq#format-your-code

There are are resources (tutorials, references, examples) here:

Check out the GUI section in the examples for some insight.

Example code:

float positionX1;
float positionY1;

void setup()
  {
  size(400, 400);
  positionX1 = width/2;
  positionY1 = height/2;
  println(width, height);
  textSize(16);
  textAlign(CENTER, CENTER);
  }

void draw()
  {
  background(0);
  rectMode(CENTER);
  fill(255);
  rect(positionX1, positionY1, 200, 200);
  ellipseMode(CENTER);
  circle(positionX1, positionY1, 200);
  mouseOver();

  line(positionX1, positionY1, mouseX, mouseY);
  }

void mouseOver()
  {
  float d1 = dist(positionX1, positionY1, mouseX, mouseY);
  if (d1<100)
    {
    fill(0, 255, 0);  
    text("Over!", mouseX, mouseY);
    println("Over!", mouseX, mouseY);
    }
  else
    {
    fill(255, 0, 0); 
    text("Out!", mouseX, mouseY);
    println("Out!", mouseX, mouseY);
    }
  }

If you are using a button Class such as this:
https://blog.startingelectronics.com/a-simple-button-for-processing-language-code/

You may want to start with these tutorials:

And related references:

:)