binding - How to bindBidirectional comboboxes and checkboxes -
i've following class:
public class model { ... private simplestringproperty currency; public simplestringproperty currencyproperty() { if(currency == null){ currency = new simplestringproperty(); } return currency; } ... } and bind (textfield) above class follows:
@fxmlcontroller("view.fxml") public class controller { ... @fxml private textfield tf_acc_num; @inject private model model; ... @postconstruct public void init(){ tf_acc_num.textproperty().bindbidirectional(model.currencyproperty()); ... }} it ok. binding comboboxes , checkboxes? assume combobox as
@fxml private combobox<string> cb_currency; and put values in inside init() method
cb_currency.getitems().addall( "usd", "eur", "rub" );
does
cb_currency.valueproperty().bindbidirectional(model.currencyproperty()); work?
Comments
Post a Comment