我正在使用ControlsFX通知来显示一组消息。文本对我来说不是完美的方式,所以我用TableView表示数据。
import org.controlsfx.control.Notifications;
......
TableView<NotificationModel> notificationTable = new TableView();
......
Notifications notification = Notifications.create()
.title("Transaction Notifications")
.text(null)
.graphic(notificationTable)
.position(Pos.BOTTOM_RIGHT)
.hideAfter(Duration.minutes(1));
notification.show();正常情况下,通知如下所示:

但通知在大多数情况下看起来是损坏的,如下所示。它似乎显示>1个通知,相互重叠。

我测试了ControlsFX示例jar文件,选择了“图形选项:总替换图形”。它表现出同样的腐败行为。

当用图形显示非文本通知时,它看起来像是来自ControlsFX的错误。有谁遇到过类似的问题吗?我正在macOS sera10.12.2,ControlsFX 8.40.12上开发。
发布于 2017-01-11 11:29:06
我解决了我的问题,在AnchorPane中包装TableView,然后设置为通知的图形。
AnchorPane anchorPane = new AnchorPane(notificationTable);
Notifications notification = Notifications.create()
.title("Transaction Notifications")
.text(null)
.graphic(anchorPane)
.position(Pos.BOTTOM_RIGHT)
.hideAfter(Duration.minutes(1));
notification.show();我从这里得到了提示:ControlsFX Issue Tracker
https://stackoverflow.com/questions/41559932
复制相似问题