Skype图标很小,并且隐藏在桌面附近时钟的左下角。我可以使用Swing或Abstract Window Toolkit在Java上创建自己的应用程序这样的东西吗?
最佳答案
是。您可以使用Java 6中引入的SystemTray类。
基本步骤是:
final PopupMenu popup = new PopupMenu();
final TrayIcon trayIcon =
new TrayIcon(createImage("images/bulb.gif", "tray icon"));
final SystemTray tray = SystemTray.getSystemTray();
// Populate popup menu
trayIcon.setPopupMenu(popup);
try {
tray.add(trayIcon);
} catch (AWTException e) {
System.out.println("TrayIcon could not be added.");
}
见http://docs.oracle.com/javase/tutorial/uiswing/misc/systemtray.html