So habe ich Instrument
Klasse und Controller
Klasse erstellt. Ich habe ein großes Problem mit bindingBidirectional()
Methode. Es gibt mir einen Fehler, wenn ich Combobox
Eigenschaft mit AmountProperty
in Instrument
Klasse zu binden bin versucht.[JavaFx] Was ist falsch an dieser Bindung?
amount.valueProperty().bindBidirectional(instrument.amountProperty());
Was mache ich hier falsch?
Controller class
public class Controller implements Initializable{
@FXML
private ComboBox<Integer> amount = new ComboBox<>();
ObservableList<Integer> amountOptions = FXCollections.observableArrayList(0, 5, 10, 25, 50);
Instrument instrument = new Instrument();
@Override
public void initialize(URL location, ResourceBundle resources) {
amount.getItems().addAll(amountOptions);
//THIS ONE IS NOT WORKING
amount.valueProperty().bindBidirectional(instrument.amountProperty());
}}
Und Instrument
Klasse:
public class Instrument {
private IntegerProperty amount = new SimpleIntegerProperty();
public int getAmount() {
return amount.get();
}
public IntegerProperty amountProperty() {
return amount;
}
public void setAmount(int amount) {
this.amount.set(amount);
}
}
Welche Fehler erhalten Sie? – assylias
Siehe http://stackoverflow.com/questions/24889638/javafx-properties-in-tableview –
java: Keine geeignete Methode gefunden für bindBidirectional (javafx.beans.property.IntegerProperty) Methode javafx.beans.property.Property.bindBidirectional (javafx.beans.property.Property) ist nicht anwendbar (Argument stimmt nicht überein; javafx.beans.property.IntegerProperty kann nicht in javafx.beans.property.Property konvertiert werden) Methode –
Rocky3582