How to put ComboBoxTableCell in a TableView?

后端 未结 1 1648
一向
一向 2021-01-06 16:20

I\'m trying to put a ComboBox in a table cell, but I can\'t. the code is the next:

private void cargaTablaDesglose() {
    TableColumn col         


        
1条回答
  •  时光取名叫无心
    2021-01-06 16:56

    The part of the problem is that you're trying to set cell factory into cell value factory field of TableColumn. Try this instead:

    ObservableList cbValues = FXCollections.observableArrayList("1", "2", "3");
    
    TableColumn column2 = new TableColumn<>(Desglose2);
    column2.setCellFactory(ComboBoxTableCell.forTableColumn(new DefaultStringConverter(), cbValues));
    

    0 讨论(0)
提交回复
热议问题