Swing/AnimatedTrayIcon のバックアップ差分(No.20)
- バックアップ一覧
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- バックアップ を表示
- Swing/AnimatedTrayIcon へ行く。
- 1 (2007-02-05 (月) 02:07:43)
- 2 (2007-02-05 (月) 19:00:34)
- 3 (2007-04-19 (木) 21:11:50)
- 4 (2007-04-19 (木) 22:17:20)
- 5 (2007-10-20 (土) 02:51:44)
- 6 (2009-04-13 (月) 14:23:56)
- 7 (2010-12-12 (日) 23:19:31)
- 8 (2011-04-29 (金) 15:30:11)
- 9 (2013-05-19 (日) 16:40:31)
- 10 (2014-01-30 (木) 17:38:57)
- 11 (2014-02-04 (火) 00:34:21)
- 12 (2014-11-01 (土) 00:46:09)
- 13 (2015-11-03 (火) 03:31:26)
- 14 (2016-06-24 (金) 16:40:30)
- 15 (2017-08-15 (火) 14:02:44)
- 16 (2017-11-02 (木) 15:34:40)
- 17 (2018-08-14 (火) 16:25:17)
- 18 (2019-05-17 (金) 17:58:10)
- 19 (2021-02-10 (水) 11:02:03)
- 20 (2022-08-20 (土) 22:15:25)
- 21 (2024-04-12 (金) 14:50:28)
- 追加された行はこの色です。
- 削除された行はこの色です。
--- category: swing folder: AnimatedTrayIcon title: TrayIconのアニメーション tags: [SystemTray, Icon, Animation] author: aterai pubdate: 2007-02-05T02:07:43+09:00 description: SystemTrayに追加したトレイアイコンをアニメーションさせます。 image: https://lh5.googleusercontent.com/_9Z4BYR88imo/TQTHtWabBgI/AAAAAAAAARk/J0ExgthCnn4/s800/AnimatedTrayIcon.png --- * 概要 [#summary] `SystemTray`に追加したトレイアイコンをアニメーションさせます。 #download(https://lh5.googleusercontent.com/_9Z4BYR88imo/TQTHtWabBgI/AAAAAAAAARk/J0ExgthCnn4/s800/AnimatedTrayIcon.png) * サンプルコード [#sourcecode] #code(link){{ final TrayIcon icon = new TrayIcon(imglist[0], "TRAY", popup); TrayIcon icon = new TrayIcon(imglist[0], "TRAY", popup); animator = new Timer(100, new ActionListener() { private int idx = 0; @Override public void actionPerformed(ActionEvent e) { icon.setImage(imglist[idx]); idx = (idx + 1) % imglist.length; } }); }} * 解説 [#explanation] `16x16`の画像を`3`パターン用意し、これを`JDK 6`で追加された`TrayIcon#setImage(Image)`メソッドを使って切り替えることでトレイアイコンのアニメーションを行っています。 上記のサンプルでは、`16x16`の画像を`3`パターン用意しこれを`JDK 6`で追加された`TrayIcon#setImage(Image)`メソッドを使って切り替えることでトレイアイコンのアニメーションを行っています。 * 参考リンク [#reference] - [[SystemTrayにアイコンを表示>Swing/SystemTray]] - [[TrayIconのダブルクリック>Swing/ClickTrayIcon]] * コメント [#comment] #comment - `animated gif`が使用できればより簡単だと思うが、作った`Gif`が悪いのか、環境のせいなのか、残像がでてしまう。 -- &user(aterai); &new{2007-02-05 (月) 19:00:34}; -- メモ: [https://bugs.openjdk.java.net/browse/JDK-6453582 [JDK-6453582] Animation gif too fast - Java Bug System] -- &user(aterai); &new{2007-04-19 (木) 21:11:50}; -- 上のバグ?でウェイトが効かずに残像が残っていたのではなく、前のコマがそのまま残して透過色(背景色)でクリアしないタイプ?のアニメ`GIF`になっていた。[http://homepage3.nifty.com/furumizo/giamd.htm Giam]を使って、全コマの消去方法を「背景色で塗りつぶす」に変更したファイルを使用すると、正常に描画されるようになった。 -- &user(aterai); &new{2007-04-19 (木) 22:04:52}; #comment