Monday, 15 February 2010

javafx - JavaFX8 triggering an event if the Node is shown on screen -



javafx - JavaFX8 triggering an event if the Node is shown on screen -

in javafx 8 have few tabs in tabbed pane, these tabs added dynamically based on logic. tab's content loaded fxml.

when tab active , visible 1 of node nowadays in tab has populated starting task. task must stop if other tab chosen. i.e when tab contents visible should start task , if tab no longer visible need stop task.

i have tried attaching changelistener visibleproperty of 1 of node's in tab, doesn't produce changeevent expected.

any thoughts?

attach listener selecteditem property of tabpane's selection model:

tabpane.getselectionmodel() .selecteditemproperty() .addlistener((obs, oldtab, newtab) -> { // if oldtab == tab node, stop task // if newtab == tab node, start task });

javafx javafx-8

No comments:

Post a Comment