Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX onInputMethodTextChanged not called after focus is lost

I got something like this in mi fxml file:

<TextField fx:id="id" onInputMethodTextChanged="#foo" prefWidth="200.0" promptText="" />

But when I run it, I TAB or mouse out of the TextField control and nothing happens ("foo" isn't called) .

like image 200
nailujed Avatar asked Oct 18 '12 13:10

nailujed


1 Answers

The onInputMethodTextChanged property of TextField is applicable only if the ConditionalFeature.INPUT_METHOD is supported by the platform. To check this try

Platform.isSupported(ConditionalFeature.INPUT_METHOD)

If you are trying to do some work when the user focuses out from textfield, try

textField.focusedProperty().addListener(new ChangeListener<Boolean>() {
    @Override
    public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
        if(!newValue) {
            System.out.println("Focusing out from textfield");
        }
    }
});
like image 169
Uluk Biy Avatar answered Sep 28 '22 06:09

Uluk Biy