How to set placeholder for TextField
in JavaFX? How can I do this w/o JavaScript?
Asked
Active
Viewed 3.3k times
35

Tony
- 3,605
- 14
- 52
- 84
-
Related: [Clear prompt text in JavaFX TextField only when user starts typing](http://stackoverflow.com/questions/25125563/clear-prompt-text-in-javafx-textfield-only-when-user-starts-typing). – jewelsea Dec 13 '16 at 19:03
2 Answers
15
In JavaFX, you can set like the following:
TextField searchInput = new TextField();
searchInput.setId("textField");
searchInput.setPromptText("Search");

Jun Wei
- 151
- 1
- 3