How to put ComboBoxTableCell in a TableView?

后端 未结 1 1638
一向
一向 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<String> cbValues = FXCollections.observableArrayList("1", "2", "3");
    
    TableColumn<Map, String> column2 = new TableColumn<>(Desglose2);
    column2.setCellFactory(ComboBoxTableCell.forTableColumn(new DefaultStringConverter(), cbValues));
    
    0 讨论(0)
提交回复
热议问题