ControlsFX通知图形已损坏

时间:2017-01-10 01:51:18

标签: notifications tableview javafx-8 controlsfx

我正在使用ControlsFX Notification来显示一组消息。文本对我来说不是完美的方式,所以我在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();

通常情况下,通知如下所示:

Notification - OK

但是通知在大多数情况下都会出现损坏,如下所示。它似乎显示&gt; 1通知,相互重叠。

Notification - corrupted

我测试了ControlsFX样本jar文件,选择&#34;图形选项:总替换图形&#34;。它显示了同样的损坏行为。

Notification - Corrupted

当使用图形显示非文本通知时,它看起来像来自ControlsFX的错误。有人遇到类似的问题?我正在开发macOS Sierra 10.12.2,ControlsFX 8.40.12。

1 个答案:

答案 0 :(得分:0)

我通过在AnchorPane中包装TableView来修复我的问题,然后设置为Notifications图形。

  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