1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

JavaでWindows Notification APIを呼ぶ

Posted at

普通にjava.awt.SystemTrayを呼ぶだけでよい。

Notification.java
public void notification() {
        SystemTray tray = SystemTray.getSystemTray();

        Image image = Toolkit.getDefaultToolkit().createImage(
        		getClass().getResource("適当な画像.png"));

        TrayIcon trayIcon = new TrayIcon(image, "Tray Demo");
        trayIcon.setImageAutoSize(true);
        trayIcon.setToolTip("System tray icon demo");
        tray.add(trayIcon);
        trayIcon.setImageAutoSize(true);
        trayIcon.displayMessage("Hello, World",
                "notification demo", MessageType.INFO);

}

notification.png

一番下に表示されているのは、AppIdでTrayIconクラスではその操作APIが提供されていないようだ。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?