像在 Skype 中一样为 java 应用程序创建图标
Create icon for java application as in skype
Skype 图标很小,隐藏在我桌面左下角的时钟附近。我可以使用 Swing 或 Abstract Window 工具包在 java 上为我自己的应用程序创建类似的东西吗?
是的。您可以使用 Java 6.
中介绍的系统托盘 class
基本步骤是:
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
Skype 图标很小,隐藏在我桌面左下角的时钟附近。我可以使用 Swing 或 Abstract Window 工具包在 java 上为我自己的应用程序创建类似的东西吗?
是的。您可以使用 Java 6.
中介绍的系统托盘 class基本步骤是:
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