<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
I answer my self for posters...<br>
<br>
<div style="background-color:#1e1f22;color:#bcbec4">
<pre style="font-family:'JetBrains Mono',monospace;font-size:9,8pt;">.<span style="color:#d5b778;">table-view </span>.<span style="color:#d5b778;">table-cell </span>{
<span style="color:#bababa;">-fx-alignment</span>: <span style="color:#6aab73;">center-left</span>;
}</pre>
</div>
<br>
done the trick.<br>
<br>
thanks<br>
Davide<br>
<br>
Il 14/08/2023 15:34, Davide Perini ha scritto:<br>
<blockquote type="cite"
cite="mid:56342753-93d0-2f9e-1478-35ec8ee690ce@dpsoftware.org">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
Hi all,<br>
hope that someone can help with this :)<br>
<br>
I have a TableView like this:<br>
<br>
<img src="cid:part1.BokSWkE2.7Tp3KrCO@dpsoftware.org" alt=""
class=""><br>
<br>
If I add a remove button in the table like this:<br>
<br>
<div style="background-color:#1e1f22;color:#bcbec4">
<pre style="font-family:'JetBrains Mono',monospace;font-size:9,8pt;"><span style="color:#cf8e6d;">private </span>TableColumn<Satellite, Void> <span style="color:#56a8f5;">getSatelliteVoidTableColumn</span>() {
TableColumn<Satellite, Void> colBtn = <span style="color:#cf8e6d;">new </span>TableColumn<>(<span style="color:#6aab73;">""</span>);
colBtn.setMaxWidth(Constants.<span style="color:#c77dbb;font-style:italic;">REMOVE_BTN_TABLE</span>);
Callback<TableColumn<Satellite, Void>, TableCell<Satellite, Void>> cellFactory = <span style="color:#cf8e6d;">new </span>Callback<>() {
<span style="color:#b3ae60;">@Override
</span><span style="color:#b3ae60;"> </span><span style="color:#cf8e6d;">public </span>TableCell<Satellite, Void> <span style="color:#56a8f5;">call</span>(<span style="color:#cf8e6d;">final </span>TableColumn<Satellite, Void> param) {
<span style="color:#cf8e6d;">return new </span>TableCell<>() {
<span style="color:#cf8e6d;">private final </span>Button <span style="color:#c77dbb;">btn </span>= <span style="color:#cf8e6d;">new </span>Button(Constants.<span style="color:#c77dbb;font-style:italic;">UNICODE_X</span>);
{
<span style="color:#c77dbb;">btn</span>.setOnAction((ActionEvent event) -> {
Satellite data = getTableView().getItems().get(getIndex());
populateFields(data);
<span style="color:#c77dbb;font-style:italic;">satellitesTableData</span>.remove(data);
});
}
<span style="color:#b3ae60;">@Override
</span><span style="color:#b3ae60;"> </span><span style="color:#cf8e6d;">public void </span><span style="color:#56a8f5;">updateItem</span>(Void item, <span style="color:#cf8e6d;">boolean </span>empty) {
<span style="color:#cf8e6d;">super</span>.updateItem(item, empty);
<span style="color:#cf8e6d;">if </span>(empty) {
setGraphic(<span style="color:#cf8e6d;">null</span>);
} <span style="color:#cf8e6d;">else </span>{
setGraphic(<span style="color:#c77dbb;">btn</span>);
}
}
};
}
};
colBtn.setCellFactory(cellFactory);
<span style="color:#cf8e6d;">return </span>colBtn;
}</pre>
</div>
<div style="background-color:#1e1f22;color:#bcbec4">
<pre style="font-family:'JetBrains Mono',monospace;font-size:9,8pt;">TableColumn<Satellite, Void> colBtn = getSatelliteVoidTableColumn();
<span style="color:#c77dbb;">satelliteTable</span>.getColumns().add(<span style="color:#2aacb8;">0</span>, colBtn);</pre>
</div>
<br>
The text inside the cell of the table is not vertically centered.<br>
How can I center it?<br>
<br>
Thanks<br>
Davide<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</blockquote>
<br>
</body>
</html>