2

This is a feature that I have noticed in many web apps and I would like it to be in a TextArea on my JavaFX app.

The desktop version of Hemingway provides a good example:

Before content added

After content added

David Kriz
  • 55
  • 6
  • 2
    [promptText](http://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/TextInputControl.html#promptTextProperty) is what you want. – VGR Mar 30 '17 at 21:14

1 Answers1

6

Set promptText on the TextArea.

 textArea.setPromptText("Type or paste something to get started...");

If you want a more sophisticated solution that transfers the PromptText to a label above the TextField, so the prompt text is still visible when the user types, then the 3rd party Gluon glisten library does that, or MaterialFX has many text field prompt and label options. From your description, though you probably don't need the glisten functionality and the standard promptText implementation in JavaFX TextAreas is probably fine for you.

Related:

jewelsea
  • 150,031
  • 14
  • 366
  • 406