Reputation: 51
Hello guys I've the next code:
javafx.scene.control.TextInputControl control
control.focusedProperty().addListener(
{ observableValue, t, t1 ->
//some code
}
)
Supossed that the code is like java 8:
control.focusedProperty().addListener((observableValue,t,t1)->{
//some code
});
But when I try to run groovy throws the following error:
ADVERTENCIA: groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method javafx.scene.Node$FocusedProperty#addListener.
Cannot resolve which method to invoke for [class com.srs.javafx.utils.textfield.ValidationTextField$_setMinLenghtValidation_closure1] due to overlapping prototypes between:
[interface javafx.beans.InvalidationListener]
[interface javafx.beans.value.ChangeListener]
The question is... How I can to do the next code with lamda groovy?
control.focusedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
}
});
Upvotes: 0
Views: 830
Reputation: 97140
Try adding as ChangeListener
after your closure definition.
Upvotes: 1