ControlsFX Notification Graphic corrupted

932 Views Asked by At

I am using ControlsFX Notification to display a group of messages. Text is not perfect way for me, so I present data in 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();

In normal case, notification looks like this:

Notification - OK

But notification appears corrupted most of the time, as below. It seems showing > 1 Notification, overlaying on each other.

Notification - corrupted

I tested ControlsFX sample jar file, choosing "Graphic Options: Total-replacement graphics". It shows same corrupted behaviour.

Notification - Corrupted

It looks like a bug from ControlsFX, when showing non-text notification with graphics. Anyone facing similar issue? I am developing on macOS Sierra 10.12.2, ControlsFX 8.40.12.

1

There are 1 best solutions below

0
On

I got my problem fixed by wrapping TableView in AnchorPane, then set as graphic of 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();

I got the hint from here: ControlsFX Issue Tracker