pranahata
pranahata

Reputation: 540

javafx listener on BooleanBinding

Is it possible to add listeners to BooleanBindings?

I have

        schedule.disableProperty().addListener(new InvalidationListener() {
            @Override
            public void invalidated(Observable observable) {
                System.out.println("schedule.disableProperty(). " + schedule.disableProperty().get());
            }
        });
        BooleanBinding scheduleEnabled = schedule.disableProperty().not();
        scheduleEnabled.addListener(new InvalidationListener() {
            @Override
            public void invalidated(Observable observable) {
                System.out.println("scheduleEnabled " + scheduleEnabled.get());
            }
        });

Only the 1st listener shows on System.out but not the second.

Why is this?

Upvotes: 0

Views: 99

Answers (1)

mipa
mipa

Reputation: 10640

It looks to me as if scheduleEnabled is just garbage collected because there is no more reference to it.

Upvotes: 2

Related Questions