# Processing Confirmation Window

**URL:** <https://discourse.processing.org/t/processing-confirmation-window/25816>\
**Category:** Coding Questions\
**Created:** [November 29, 2020, 5:45pm UTC](https://discourse.processing.org/t/processing-confirmation-window/25816 "2020-11-29T17:45:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Idris](https://avatars.discourse-cdn.com/v4/letter/i/13edae/32.png) [@Idris](https://discourse.processing.org/u/Idris)\
**Post date:** [November 29, 2020, 5:45pm UTC](https://discourse.processing.org/t/processing-confirmation-window/25816/1 "2020-11-29T17:45:52Z")

</div>

Hey guys!. Can you all please help me of how to make a confirmation window before exiting the sketch with the options ‘Yes’ and ‘No’ in Processing 3.0 Java? Here is my simple code:  
boolean correct[] = {false,false};

void setup(){  
fullScreen();  
smooth(2);  
}

void draw(){  
background(0);  
translate(width/2, height/2);  
if(key==‘e’){  
correct[1]=true;  
confirm();  
if (key==‘n’){  
correct[0]=false;  
if(key==‘y’&&correct[0]==false){  
key=0;  
}  
}else if(key==‘y’){  
correct[0]=true;  
}  
}  
if(key==‘y’&&correct[0]==true){  
super.stop();  
exit();  
}  
if(key==‘y’&&correct[0]==false){  
key=0;  
}  
}

void confirm(){  
stroke(255);  
textSize(20);  
text(“Do you really want to exit?”, -125, 0);  
if(key==‘y’&&correct[0]==true){  
super.stop();  
exit();  
}  
if(key==‘y’&&correct[0]==false){  
key=0;  
}  
}

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [November 30, 2020, 5:46am UTC](https://discourse.processing.org/t/processing-confirmation-window/25816/2 "2020-11-30T05:46:13Z")

</div>

> **[Inputs.java](https://Gist.GitHub.com/GoToLoop/bba0c288aaeeb5ef9bb1)**
>
> GitHub Gist: instantly share code, notes, and snippets.
