# Quit program from JOptionpane

**URL:** <https://discourse.processing.org/t/quit-program-from-joptionpane/18396>\
**Category:** Beginners\
**Created:** [March 5, 2020, 12:39am UTC](https://discourse.processing.org/t/quit-program-from-joptionpane/18396 "2020-03-05T00:39:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NotConsumable](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@NotConsumable](https://discourse.processing.org/u/NotConsumable)\
**Post date:** [March 5, 2020, 12:39am UTC](https://discourse.processing.org/t/quit-program-from-joptionpane/18396/1 "2020-03-05T00:39:02Z")

</div>

I am wondering if it is an if statement or a loop along side a pre determined string in order to make the exit(); function run specifically when a certain phrase is typed into the message box in  
JOptionpane.showInputDialoge() i cannot seem to get it to work at all even with an if statement stating to run that action when “quit” has been typed into the input bar. I apologize if my wording it horrible.

---

<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:** [March 5, 2020, 12:46am UTC](https://discourse.processing.org/t/quit-program-from-joptionpane/18396/2 "2020-03-05T00:46:44Z")

</div>

> [@NotConsumable](#):
>
> … when “quit” has been typed into the input bar.

Make sure you’re checking via method **equals()**, and not via equality operator `==`:

> **[equals() / Reference](https://processing.org/reference/String_equals_.html)**
>
> Compares two strings to see if they are the same. This method is necessary because it's not possible to compare strings using the equality operator (==). Returns true if the strings are the sam…

`if ("quit".equals(input)) exit();`
