# Screen with two buttons not showing the buttons

**URL:** https://discourse.processing.org/t/screen-with-two-buttons-not-showing-the-buttons/7230
**Category:** Coding Questions
**Created:** [January 5, 2019, 6:26pm UTC](https://discourse.processing.org/t/screen-with-two-buttons-not-showing-the-buttons/7230 "2019-01-05T18:26:50Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Banansplitt](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@Banansplitt](https://discourse.processing.org/u/Banansplitt)
#### Post date: [January 5, 2019, 6:26pm UTC](https://discourse.processing.org/t/screen-with-two-buttons-not-showing-the-buttons/7230/1 "2019-01-05T18:26:50Z")

</div>

I tried making a programme that shows a screen with two buttons but all it shows is a blank screen. This is my code:

```auto
int rect1X, rect1Y; //Position Button 1 (Option 1)
int rect2X, rect2Y; //Position Button 2 (Option 2)
int rect1SizeW = displayWidth/3; //Width Button 1 (Option 1)
int rect1SizeH = displayHeight/5*2; //Height Button 1 (Option 1)
int rect2SizeW = displayWidth/3; //Width Button 2 (Option 2)
int rect2SizeH = displayHeight/5*2; //Height Button 2 (Option 2)
color rect1Color, rect2Color, baseColor;
color rect1Highlight, rect2Highlight;
boolean rect1Over = false;
boolean rect2Over = false;

void setup(){
  fullScreen();
  background(51, 51, 51);
  
  rect1Color = color(65, 51, 122);
  rect1Highlight = color(131, 119, 209);
  rect2Color = color(65, 51, 122);
  rect2Highlight = color(131, 119, 209);
  
  rect1X = displayWidth/9;
  rect1Y = displayHeight/5*3;
  rect2X = displayWidth/9*5;
  rect2Y = displayHeight/5*3;
}

void draw(){
  update(mouseX, mouseY);
  
  if (rect1Over){
    fill (rect1Highlight);
  } else {
    fill (rect1Color);
  }
  stroke(102, 106, 134);
  rect(rect1X, rect1Y, rect1SizeW, rect1SizeH);
  
  if (rect2Over){
    fill (rect2Highlight);
  } else {
    fill (rect2Color);
  }
  stroke(102, 106, 134);
  rect(rect2X, rect2Y, rect2SizeW, rect2SizeH);
  
}

void update(int x, int y) {
  if ( overRect2(rect2X, rect2Y, rect2SizeH, rect2SizeW) ) {
    rect2Over = true;
    rect1Over = false;
  } else if ( overRect1(rect1X, rect1Y, rect1SizeH, rect1SizeW) ) {
    rect1Over = true;
    rect2Over = false;
  } else {
    rect2Over = rect1Over = false;
  }
}

void mousePressed() {
  if (rect1Over) {
    
  }
  if (rect2Over) {
    
  }
}

boolean overRect1(int x, int y, int width, int height) {
  if (mouseX >= x && mouseX <= x+width && 
      mouseY >= y && mouseY <= y+height) {
    return true;
  } else {
    return false;
  }
}

boolean overRect2(int x, int y, int width, int height) {
  if (mouseX >= x && mouseX <= x+width && 
      mouseY >= y && mouseY <= y+height) {
    return true;
  } else {
    return false;
  }
}

```

I would really appreciate it if anyone found out what I did wrong 😀  
Thank you

---

<div class="post-metadata">

### Author: ![BennyHacker](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/bennyhacker/32/2969_2.png) [@BennyHacker](https://discourse.processing.org/u/BennyHacker)
#### Post date: [January 5, 2019, 7:46pm UTC](https://discourse.processing.org/t/screen-with-two-buttons-not-showing-the-buttons/7230/2 "2019-01-05T19:46:18Z")

</div>

The reason your rects aren’t working is because you’re giving them dimensions that do not exist yet! You should declare the rectSize variables after you call fullScreen()
