Nicolas Gomes
Nicolas Gomes

Reputation: 11

I want the user to enter text in a text box, how can i do this?

I want the user to enter text in a text box (such as a login text box on some site).

I tried to search in text() bibliography and other similar functions.

Upvotes: 1

Views: 969

Answers (2)

Kevin Workman
Kevin Workman

Reputation: 42176

What you're describing is called a graphical user interface, or GUI. There are many ways to approach this problem:

  1. Code it yourself. Use something like the rect() function to draw a text box, and the keyPressed() function to detect key presses.
  2. Use a library. The Processing libraries page lists several GUI libraries. Try each of them out and see which one you like best.
  3. Use a more general GUI library. If you're deploying as Java, then you might use Swing or JavaFX. If you're deploying as JavaScript, then you might use HTML elements.

Any of the above might work, and which approach you choose depends more on you, your context, and your preferences. We can't tell you which is best, because it's all up to what you prefer.

Upvotes: 1

laancelot
laancelot

Reputation: 3207

This guy seems to have figured it out: http://www.sojamo.de/libraries/controlP5/. Look for the textArea control.

If you don't like this, I read that the g4p library had something like an inputbox. Otherwise you will have to draw it yourself (which would be a nice exercise) using keyboard inputs and the like.

Upvotes: 1

Related Questions