问题
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:
But notification appears corrupted most of the time, as below. It seems showing > 1 Notification, overlaying on each other.
I tested ControlsFX sample jar file, choosing "Graphic Options: Total-replacement graphics". It shows same corrupted behaviour.
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:
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
来源:https://stackoverflow.com/questions/41559932/controlsfx-notification-graphic-corrupted