单元格背景超出单元格高度

时间:2019-07-21 16:23:19

标签: javafx tableview javafx-8

我有一个包含几列和几行的TableView。 这是CSS的摘录:

.table-view {
    -fx-font-size: 8.0pt;
}

.table-row-cell {
    -fx-cell-size: 1.8em;
}

在单元工厂中是:

StringBuilder style = new StringBuilder();
if (item.getWeight() != null) {
    style.append("-fx-font-weight: ").append(item.getWeight()).append("; ");
}
if (item.getTextColor() != null) {
    style.append("-fx-text-fill: ").append(item.getTextColor().toString().replace("0x","#")).append("; ");
}
if (item.getBackgroundColor() != null) {
    style.append("-fx-background-color: ").append(item.getBackgroundColor().toString().replace("0x","#")).append("; ");
}
setStyle(style.toString());

现在,问题是当我设置背景颜色时,背景变得比单元格高度大。

Look at different heights

我找不到问题所在。

0 个答案:

没有答案
相关问题