I need to track changes in absolute position and size of a node in javafx.Any change that is caused by resizing window or user manipulation,...
node.boundsInLocalProperty().addListener(new ChangeListener<Bounds>() {
@Override
public void changed(ObservableValue<? extends Bounds> observable,Bounds oldValue, Bounds newValue) {
System.err.println("Changed!");
}
});
node.boundsInParentProperty().addListener(new ChangeListener<Bounds>() {
@Override
public void changed(ObservableValue<? extends Bounds> observable,Bounds oldValue, Bounds newValue) {
System.err.println("Changed!");
}
});
I tried these solutions but doesn't work!
please help me, thanks.
This is quite heavy on performance, so I do not recommend doing this with a large number of nodes in the scene graph, but:
You can also do the following, which might be less prone to premature garbage collection: