[英]javafx tablecolumn is not showing anything if all values are null?
我正在使用javafx tableview。
我的其中一列當前所有行都為null,但我仍然希望通過在這些列中寫入null來顯示它。
有什么建議嗎?
您可以使用setCellFactory(),並在updateItem()方法上,檢查item是否為null,如果為true,則輸入“ null”
@Override
public void updateItem(T item, boolean empty) {
super.updateItem(item, empty);
if (item == null || empty) {
setText("null");
setGraphic(null);
} else {
//Things to do if it's not null
}
}
檢查有關詳細信息http://www.java2s.com/Code/Java/JavaFX/customcellfactory.htm但要顯示null,請按照我說的做
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.