# Can you type text on the displayed screen and make Processing use the date to change a variable

**URL:** https://discourse.processing.org/t/can-you-type-text-on-the-displayed-screen-and-make-processing-use-the-date-to-change-a-variable/45126
**Category:** Coding Questions
**Created:** [October 2, 2024, 7:37pm UTC](https://discourse.processing.org/t/can-you-type-text-on-the-displayed-screen-and-make-processing-use-the-date-to-change-a-variable/45126 "2024-10-02T19:37:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Istimereal](https://avatars.discourse-cdn.com/v4/letter/i/ccd318/32.png) [@Istimereal](https://discourse.processing.org/u/Istimereal)
#### Post date: [October 2, 2024, 7:37pm UTC](https://discourse.processing.org/t/can-you-type-text-on-the-displayed-screen-and-make-processing-use-the-date-to-change-a-variable/45126/1 "2024-10-02T19:37:41Z")

</div>

Hi

Is it possible to to make a input box on the screen that run the sketch where I can type text or numbers that will influence a variable from the initial run. So the new input is read by processing. One variable is influenced by what I type. And either the screen is updated by the new variable size. Eg. a drawn circle is now larger or smaller. Because a String variable is updated. It alters a int variable through an array and after the value changes. the conditions for the draw is changed. Its also ok if I can type text on the display screen and hit run button and variables have been changed.

Thanks in advance for any suggestions!

---

<div class="post-metadata">

### Author: ![NumericPrime](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/numericprime/32/16318_2.png) [@NumericPrime](https://discourse.processing.org/u/NumericPrime)
#### Post date: [October 2, 2024, 8:21pm UTC](https://discourse.processing.org/t/can-you-type-text-on-the-displayed-screen-and-make-processing-use-the-date-to-change-a-variable/45126/2 "2024-10-02T20:21:31Z")

</div>

Is this what you need?

```auto
import javax.swing.*;
String text;
text= JOptionPane.showInputDialog("Please input your text.");
println(text);

```

Note: while this window is up the sketch is paused.  
If you want to have the sketch run while this window is active you’ll need to multithread and provide a way to resolve not having the input entered yet.

If you want to further configure the window it may be worth looking into the documentation:

[JOptionPane (Java Platform SE 7 ) (oracle.com)](https://docs.oracle.com/javase/7/docs/api/javax/swing/JOptionPane.html)

---

<div class="post-metadata">

### Author: ![Istimereal](https://avatars.discourse-cdn.com/v4/letter/i/ccd318/32.png) [@Istimereal](https://discourse.processing.org/u/Istimereal)
#### Post date: [October 2, 2024, 9:14pm UTC](https://discourse.processing.org/t/can-you-type-text-on-the-displayed-screen-and-make-processing-use-the-date-to-change-a-variable/45126/3 "2024-10-02T21:14:57Z")

</div>

Thank you NumericPrime! That will do the job 😄
