How to set placeholder in JavaFX?


Question

How to set placeholder for TextField in JavaFX? How can I do this w/o JavaScript?

1
19
4/29/2014 11:20:27 AM

Accepted Answer

Use the promptText property (see ref).

44
4/29/2014 12:11:33 PM

In JavaFX, you can set like the following:

TextField searchInput = new TextField();
searchInput.setId("textField");
searchInput.setPromptText("Search");

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon