I answer my self for posters... .table-view .table-cell { -fx-alignment:center-left; }
done the trick. thanks Davide Il 14/08/2023 15:34, Davide Perini ha scritto:
Hi all, hope that someone can help with this :) I have a TableView like this: If I add a remove button in the table like this: private TableColumn<Satellite, Void>getSatelliteVoidTableColumn() { TableColumn<Satellite, Void> colBtn =new TableColumn<>(""); colBtn.setMaxWidth(Constants.REMOVE_BTN_TABLE); Callback<TableColumn<Satellite, Void>, TableCell<Satellite, Void>> cellFactory =new Callback<>() { @Override public TableCell<Satellite, Void>call(final TableColumn<Satellite, Void> param) { return new TableCell<>() { private final Buttonbtn =new Button(Constants.UNICODE_X); { btn.setOnAction((ActionEvent event) -> { Satellite data = getTableView().getItems().get(getIndex()); populateFields(data); satellitesTableData.remove(data); }); } @Override public void updateItem(Void item,boolean empty) { super.updateItem(item, empty); if (empty) { setGraphic(null); }else { setGraphic(btn); } } }; } }; colBtn.setCellFactory(cellFactory); return colBtn; } TableColumn<Satellite, Void> colBtn = getSatelliteVoidTableColumn(); satelliteTable.getColumns().add(0, colBtn); The text inside the cell of the table is not vertically centered. How can I center it? Thanks Davide