JavaFX 表格单元格格式 [英] JavaFX Table Cell Formatting
本文介绍了JavaFX 表格单元格格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
TableColumn<Event,Date> releaseTime = new TableColumn<>("Release Time");
releaseTime.setCellValueFactory(
new PropertyValueFactory<Event,Date>("releaseTime")
);
如何更改 releaseTime 的格式?目前它在 Date 对象上调用一个简单的 toString.
How can I change the format of releaseTime? At the moment it calls a simple toString on the Date object.
推荐答案
你可以通过 Cell Factories 来实现.见
https://stackoverflow.com/a/10149050/682495
https://stackoverflow.com/a/10700642/682495
虽然第二个链接是关于ListCell
,但同样的逻辑也完全适用于TableCell
.
You can accomplish that through Cell Factories. See
https://stackoverflow.com/a/10149050/682495
https://stackoverflow.com/a/10700642/682495
Although the 2nd link is about ListCell
, the same logic is totally applicable to TableCell
s too.
附:如果您需要一些示例代码,请在此处附上.
P.S. Still if you need some sample code, kindly will attach here.
这篇关于JavaFX 表格单元格格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文