Reputation: 805
Possible to set as background text in EditText Field?
TextField field = new TextField("(*.xml, *.java...)");
field.setStyle("-fx-prompt-text-fill: transparent;");
in java? I dont know the word for it but i want to have the text as a template or so in the background of the editText, like in Login forms and so, any ideas?
Like in the searchfield up here on this site.
Upvotes: 1
Views: 3616
Reputation: 209438
Your question is not very clear, but I think you are just asking for prompt text?
TextField field = new TextField();
field.setPromptText("(*.xml, *.java...)");
From the documentation:
TextField supports the notion of showing prompt text to the user when there is no text already in the TextField (either via the user, or set programmatically). This is a useful way of informing the user as to what is expected in the text field, without having to resort to tooltips or on-screen labels.
Upvotes: 2