Q:

How to get reference to Property ChangeListener inside ChangeListener in JavaFX? 

I want to add to property listener, wait when this listener will be called and remove this listener.  So I wrote the following code:
    ChangeListener<String> listener = (observable, oldValue, newValue) -> {
        textField.setStyle("-fx-border-color:black");
        textField.textProperty().removeListener(listener); //LINE X
    };
    textField.textProperty().addListener(listener);

However, at LINE X I get Variable listener might not have been initialized.  How can I get reference to property ChangeListener inside ChangeListener to remove it? 

A:

From the JLS, section 15.27.2:

Unlike code appearing in anonymous class declarations, the meaning of names and the this and super keywords appearing in a lambda body, along with the accessibility of referenced declarations, are the same as in the surrounding context (except that lambda parameters introduce new names). 
...
Practically speaking, it is unusual for a lambda expression to need to talk about itself (either to call itself recursively or to invoke its other methods), while it is more common to want to use names to refer to things in the enclosing class that would otherwise be shadowed (this, toString()).  If it is necessary for a lambda expression to refer to itself (as if via this), a method reference or an anonymous inner class should be used instead. 

(My emphasis.) 
So, in a nutshell, there is no way for a lambda expression to refer to itself.  You need to refactor this as an anonymous inner class:
ChangeListener<String> listener = new ChangeListener<String>() {
    @Override
    public void changed(ObservableValue<?  extends String> observable, String oldValue, String newValue) -> {
        textField.setStyle("-fx-border-color:black");
        textField.textProperty().removeListener(this); 
    }
};
textField.textProperty().addListener(listener);

Of course, you may no longer need the reference at this point:
textField.textProperty().addListener(new ChangeListener<String>() {
    @Override
    public void changed(ObservableValue<?  extends String> observable, String oldValue, String newValue) -> {
        textField.setStyle("-fx-border-color:black");
        textField.textProperty().removeListener(this); 
    }
});

