我使用java swing开发桌面聊天应用程序。 在这个应用程序中,我打开webview中的聊天页面,我能够发送和接收消息。
我想在我的应用程序中添加一项功能,如果有人给我发短信,我会在桌面上收到“收到新消息”的通知。
我该怎么做? 任何人都可以帮助我吗?
答案 0 :(得分:2)
您可以使用javaFX库ControlsFx生成通知。喜欢这个
Notifications notify = Notifications.create().title("Message Alert")
.text("New Message arrived tap to view")
.hideAfter(javafx.util.Duration.seconds(2))
.position(Pos.BOTTOM_RIGHT);
notify.darkStyle();
notify.showInformation();