The default behaviour is that the prompt text in the field is erased as the field is being focused. That is when the marker is in the field.
Is it possible to confi
Assuming you're setting prompt text via:
@FXML TextField tf;
public void someMethod() {
tf.setPromptText("This is the prompt text");
}
You can instead use tf.setText(String str) to set initial text.
Then, in the initialize method of your controller, add:
tf.setOnKeyTyped(new EventHandler() {
@Override
public void handle(KeyEvent event) {
tf.setText(null);
}
});
A link that you can refer to for additional help: Click me!