Javafx TableView如何添加序号列呢?

accountColumn.setCellValueFactory(cellData -> cellData.getValue().accountProperty());
passwordColumn.setCellValueFactory(cellData -> cellData.getValue().passwordProperty());
serverColumn.setCellValueFactory(cellData -> cellData.getValue().serverProperty());
roleNameColumn.setCellValueFactory(cellData -> cellData.getValue().roleNameProperty());
因为TableView涉及删除条目。不可能把序号放在model类里面做成一个单独的成员。这是四种其他属性。已经添加到了TableView中。但是序号应该怎么添加呢?

Alert为我定义的实体类,你换掉就行了。

 tc_num.setCellFactory((col) -> {
        TableCell<Alert, String> cell = new TableCell<Alert, String>() {
                @Override
                public void updateItem(String item, boolean empty) {
                        super.updateItem(item, empty);
                        this.setText(null);
                        this.setGraphic(null);

                        if (!empty) {
                                int rowIndex = this.getIndex() + 1;
                                this.setText(String.valueOf(rowIndex));
                        }
                }
        };
        return cell;
});

急需16个G币 有给的吗

bdong不懂啊!!!!

就是要自己做,没有现成的功能了