javafx - Convert an IntegerBinding to a DoubleBinding -
this may seem simple question, turns out it's not easy (or can't find info on how this).
i want convert integerbinding have, namely bindings.size(families);
doublebinding if bindings.divide(bindings.size(families),bindings.size(familiesall))
don't result of integerdivision. maybe there otherways achieve want, converting bindings essential must possible.
a couple of options:
bindings.createdoublebinding(() -> 1.0 * families.size() / familiesall.size, bindings.size(families), bindings.size(familiesall));
or:
bindings.divide(bindings.size(families).add(0.0), bindings.size(familiesall));
or:
bindings.size(families).add(0.0).divide(bindings.size(familiesall));
or:
doubleproperty familiessize = new simpledoubleproperty(); familiessize.bind(bindings.size(families)); bindings.divide(familiessize, bindings.size(familiesall));
Comments
Post a Comment