cd_tc_haveSymbol.setCellFactory(new Callback<TableColumn<CommunicationData,Boolean>, TableCell<CommunicationData,Boolean>>() { @Override public TableCell<CommunicationData, Boolean> call(TableColumn<CommunicationData, Boolean> param) { TableCell<CommunicationData, Boolean> cell = new TableCell<CommunicationData, Boolean>() { @Override protected void updateItem(Boolean item, boolean empty) { super.updateItem(item, empty); //清空样式 setText(null); setGraphic(null); //增加样式 if(empty == false && item != null) { HBox hBox = new HBox(); hBox.setAlignment(Pos.CENTER); //赋值 CheckBox cb = new CheckBox(); cb.setSelected(item); if(this.getTableRow() != null) { CommunicationData cd = cdData.get(this.getTableRow().getIndex()); cb.selectedProperty().bindBidirectional(cd.getHaveSymbolProperty()); } hBox.getChildren().add(cb); this.setGraphic(hBox); } } }; return cell; } });