Ram Eswar
Ram Eswar

Reputation: 37

Convert double binding to double value in JavaFX

This is my code. I want to store this total value into database

How can I do that? If I directly assign to double variable it shows error:

double binding value cannot converted into double

DoubleBinding total = Bindings.createDoubleBinding(() -> 
supplytable.getItems().stream().collect(Collectors.summingDouble(conductor::getPrice)),
                                 supplytable.getItems());
lbltotal.textProperty().bind(Bindings.format("Total: %.2f", total));

Upvotes: 1

Views: 1289

Answers (1)

DVarga
DVarga

Reputation: 21809

You can use for example getValue() or doubleValue() method of DoubleBinding:

double doubleValue = total.doubleValue();
Double value = total.getValue();

Upvotes: 1

Related Questions