Ich habe ein TableView
in FXML
, und ich möchte es binden, ist Artikel-Eigenschaft auf eine Liste in der Steuerung (wie in WPF
), mein FXML
Code ist wie folgt:FXML: Bind Tableviews Artikel Eigentum an dem Controller
<TableView fx:controller="controllers.MyController" items="$controller.loggings">
<columns>
<TableColumn text="Nom">
<cellValueFactory>
<PropertyValueFactory property="name" />
</cellValueFactory>
</TableColumn>
<TableColumn text="Type">
<cellValueFactory>
<PropertyValueFactory property="type" />
</cellValueFactory>
</TableColumn>
</columns>
</TableView>
und mein Controller ist wie folgt: ein Exception
startet
public class MyController {
public ObservableList<Logging> loggings = FXCollections.observableArrayList();
@FXML
protected void initialize(){
loggings.add(new Logging(){{
setName("hilton");
setType("hotel");
}});
}
}
Aus irgendeinem Grund. Was mache ich falsch?