I want that when a control TextField
wins the focus its content is selected. At the moment only the cursor appears where I click with the mouse and the selection disappears. I've tried with this code:
miTextField.focusedProperty().addListener((ObservableValue<? extends Boolean>
observable, Boolean valorAnterior, Boolean valorActual) -> {
if (valorActual){
miTextField.selectAll();
}
});
Substituting miTextField.selectAll()
for miTextField.selectRange(0, miTextField.getText().length())
does not work either.