ControlsFX通知图形已损坏
问题描述:
我正在使用ControlsFX通知来显示一组消息。文本对我来说并不完美,所以我在TableView中显示数据。ControlsFX通知图形已损坏
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,一个bug。任何面临类似问题的人我正在开发macOS Sierra 10.12.2,ControlsFX 8.40.12。
答
我通过在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