data binding - How to bind a DoubleProperty to an expression? -


i have doubleproperty (price) , want second doubleproperty (discountedprice) bound price - 25%.

so thought use multiply method not seem work expected:

doubleproperty price = new simpledoubleproperty(); doubleproperty pctdiscount = new simpledoubleproperty(); pctdiscount.bind(price.multiply(0.75));  price.set(100);  system.out.println(pctdiscount); 

i expecting program output 75 output is:

doubleproperty [bound, invalid]

doubleproperty wrapper class. actual value

system.out.println(pctdiscount.getvalue()); 

or

system.out.println(pctdiscount.get()); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -