英文:
Notifications in JavaFX 14
问题
我知道我可以使用以下代码创建通知:
Notifications notificationBuilder = Notifications.create()
.title(title)
.text(content)
.hideAfter(Duration.seconds(31536000))
.position(Pos.BOTTOM_RIGHT)
.onAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent a) {
//
}
});
notificationBuilder.showInformation();
但是在 IntelliJ (JDK 11 和 JavaFX 14) 中,我找不到 Notifications 类。如何在 JavaFX 14 中创建通知?
英文:
I know I can create a notification with
Notifications notificationBuilder = Notifications.create()
.title(title)
.text(content)
.hideAfter(Duration.seconds(31536000))
.position(Pos.BOTTOM_RIGHT)
.onAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent a) {
//
}
});
notificationBuilder.showInformation();
But in IntelliJ (JDK 11 and JavaFX 14)
I can't find the class Notifications.
How can I create a notification in JavaFX 14?
答案1
得分: 1
因为它似乎不属于其中任何一个。我能找到与此代码匹配的唯一类是controlsfx.bitbucket.io/org/controlsfx/control/…,它是ControlsFX项目的一部分。无论您使用哪个构建工具,都可以在此处找到它的依赖项:mvnrepository.com/artifact/org.controlsfx/controlsfx。
- ajc2000
英文:
> Because it doesn't look like it's part of either one. Only matching
> class I could find for this code is
> controlsfx.bitbucket.io/org/controlsfx/control/…, which is part of the
> ControlsFX project. Here is the dependency for whatever build tool you
> are using: mvnrepository.com/artifact/org.controlsfx/controlsfx
– ajc2000
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论