为单个字段创建类似乎有点过于复杂。有没有更快捷的方法将字符串列表分配给javafx中的单个列tableView?
我面临的问题是我无法分配到该列。
new PropertyValueFactory<String>()
期待
new PropertyValueFactory<String, String>("Some name")
列表
public static ObservableList<String> obsInstrumentNames;
public class PersonOverviewController {
@FXML
private Label lblFirstName;
@FXML
private TableView<String> instrumentTable;
@FXML
private TableColumn<String, String> instrumentName;
private Main mainApp;
public PersonOverviewController() {
}
@FXML
private void initialize() {
//This fails
instrumentName.setCellValueFactory(new PropertyValueFactory<String>());
instrumentTable.setItems(CreateStockList.obsInstrumentNames);
}
public void setMainApp(Main mainApp) {
this.mainApp = mainApp;
}
}