Windows 7 で SystemTrayIcon を有効にするためのコードを追加しました。NetBeans アプリケーション モードでは正常に動作していますが、Windows サービス モードでアプリケーションを実行している間は動作しません。以下のコードを参照してください。
if (!java.awt.SystemTray.isSupported()) {
System.out.println("SystemTray is not supported");
return;
}
final PopupMenu popup = new PopupMenu();
Image img1 = new ImageIcon(DataReporter.class.getResource("/lookandfeel/data/xear_appIcon_16.png")).getImage();
ImageIcon icon = new ImageIcon(img1);
final TrayIcon trayIcon = new TrayIcon(icon.getImage());
trayIcon.setToolTip(DataReporterProps.softwareDescriptionText);
final java.awt.SystemTray tray = java.awt.SystemTray.getSystemTray();
MenuItem aboutItem = new MenuItem("About");
popup.add(aboutItem);
trayIcon.setPopupMenu(popup);
try {
tray.add(trayIcon);
} catch (AWTException e) {
System.out.println("Cannot add the TrayIcon!");
}
Windows サービス モードでのトリガー用にコードを追加したい場合はお知らせください。