我正在编写这个非常基本的J2SE应用程序,它会时不时地提醒用户一些信息。目前我正在使用SystemTray和TrayIcon类来显示通知,但我对此并不是很满意。它不允许我调整通知,也不能给它们一个好的外观。
那么,有谁知道一个简单易用的库来生成漂亮的通知吗?
顺便说一句,我将移植到Linux (Ubuntu),但将在那里使用notify-OSD,这正是我所需要的。
发布于 2011-08-04 02:31:03
厚颜无耻的插件:我刚刚发布了一个名为Twinkle的项目,这个项目对Java Swing来说简直就是胡言乱语。
发布于 2011-07-12 21:37:47
我不知道有Java库抽象所有特定于操作系统的桌面通知。但是如果你知道,你被限制在Ubuntu (也许还有数量有限的其他操作系统),你可以创建一个自己的Interface,并为特定的操作系统实现它。
/usr/bin/notify-send访问Runtime:usr/bin/notify-send -t 30000 "Text1" "Text2" -i /path/to/48x48.png/usr/bin/notify-send对于JAVA实现,您可以查看Jazz或Mylyn (请参阅Java Desktop Notifications)。
发布于 2015-05-06 21:41:12
您可以使用JCommunique实现跨平台的Java桌面通知。以下是从维基上的examples改编的一个简短演示:
// makes a factory with the built-in clean theme
// themes are customizeable
NotificationFactory factory = new NotificationFactory(ThemePackagePresets.cleanLight());
// factories build notifications using a theme, while managers handle how
// how they appear on the screen
// this manager just simple pops up the notification in the specified location
// other managers do sliding, queues, etc.
NotificationManager plain = new SimpleManager(Location.NORTHEAST);
// creates a text notification; you can also have progress bar Notifications,
// icon Notifications, Notifications that ask for user feedback, etc.
TextNotification notification = factory.buildTextNotification("This is a title",
"This is a subtitle");
notification.setCloseOnClick(true);
// the notification will disappear after 2 seconds, or after you click it
plain.addNotification(notification, Time.seconds(2));简介:我也是这个项目的创建者。它是开源的,所以我没有从中获得任何收益。
其他一些库值得一看:
闪烁
,
JCarrierPigeon
JTelegraph
我不能张贴这些链接,因为我没有足够的声誉,但他们很容易在互联网上找到。现在,我将试着与上面的库进行比较,客观地评估我自己的库。请记住,这个列表有点广泛,因为我比其他人更了解我的项目。如果我遗漏了什么,请告诉我。
JCommunique
外,没有其他外部依赖项
https://stackoverflow.com/questions/6499140
复制相似问题