2

I'm just learning javafx.beans.property and have a question. I used a lambda expression to add Listener to a property object. But I don't know how to removed it. My code:

import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.IntegerProperty;
import javafx.beans.Observable;

public class InvalditionTest {
    public static void main(String[] args) {
        IntegerProperty counter = new SimpleIntegerProperty(100);
        counter.addListener(prop-> { System.out.println("Counter is 
        invalid)");
        counter.set(50);
        });
        counter.set(150);
        System.out.println(counter.getValue());
        counter.removeListener(???????);
        counter.set(150);
        System.out.println(counter.getValue());
    }

         public static void validated(Observable prop){

    }
}

What do I have to fill in : counter.removeListener(???????); Thanks

john16384
  • 7,800
  • 2
  • 30
  • 44
Joel
  • 21
  • 2

0 Answers0