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










Reply via email to