The most general way to display non-modal notifications is to use the Notifications class.
公式のドキュメントを参照すると、非モーダル通知を表示する一般的な実装と記載してある。
どのような挙動をするのか想像できなかったのでコードと画像を紹介します。
Version
- IntelliJ IDEA 2019.3 (Community Edition)
使い方としてはNotifications.Bus.notifyメソッドの引数にNotificationクラスを渡すと利用できる。
第4引数に渡すNotificationTypeを変更する事によって見た目と出力されるテキストの色が変わる。
Information
緑色のバルーンと黒字で文字列が出力される。
Notifications.Bus.notify(
Notification("sample", "hello", "hello! this is Information", NotificationType.INFORMATION)
)
Error
赤いバルーンと赤色の文字でログが出力される。
Notifications.Bus.notify(
Notification("sample", "hello", "this is Error", NotificationType.ERROR)
)
Warning
黄色のバルーンと黄色の文字でログが出力される。
Notifications.Bus.notify(
Notification("sample", "hello", "this is warning", NotificationType.WARNING)
)
(参考)