Swing/AnimatedToolTip のバックアップの現在との差分(No.11)
- バックアップ一覧
- 差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- バックアップ を表示
- Swing/AnimatedToolTip へ行く。
- 1 (2007-04-23 (月) 09:48:54)
- 2 (2010-12-12 (日) 23:19:07)
- 3 (2014-10-02 (木) 03:46:55)
- 4 (2015-03-02 (月) 11:23:22)
- 5 (2017-01-17 (火) 15:04:14)
- 6 (2017-12-15 (金) 14:29:05)
- 7 (2018-03-25 (日) 16:48:22)
- 8 (2018-10-15 (月) 13:19:00)
- 9 (2020-10-11 (日) 20:21:34)
- 10 (2022-07-10 (日) 04:43:58)
- 11 (2024-02-15 (木) 20:21:06)
- 12 (2024-05-09 (木) 18:01:14)
- 追加された行はこの色です。
- 削除された行はこの色です。
--- category: swing folder: AnimatedToolTip title: JToolTipのアニメーション tags: [JToolTip, JLabel, Animation, AnimatedGif, Html] author: aterai pubdate: 2007-04-23T09:48:54+09:00 description: JToolTipが表示されたとき、内部のJLabelでアイコンのアニメーションを行う方法をテストします。 image: https://lh5.googleusercontent.com/_9Z4BYR88imo/TQTHpat_rFI/AAAAAAAAARg/fzkRLOHGb7I/s800/AnimatedToolTip.png --- * 概要 [#summary] `JToolTip`が表示されたとき、内部の`JLabel`でアイコンのアニメーションを行う方法をテストします。 #download(https://lh5.googleusercontent.com/_9Z4BYR88imo/TQTHpat_rFI/AAAAAAAAARg/fzkRLOHGb7I/s800/AnimatedToolTip.png) * サンプルコード [#sourcecode] #code(link){{ ClassLoader cl = Thread.currentThread().getContextClassLoader(); URL url = cl.getResource("example/anime.gif"); JLabel l3 = new JLabel("Gif Animated ToolTip(html)"); l3.setToolTipText("<html><img src='" + url + "'>Test3</html>"); l3.setToolTipText(String.format("<html><img src='%s'>Test3", url)); }} * 解説 [#explanation] - `Timer Animated ToolTip` -- `javax.swing.Timer`を使ってアニメーションを行う`JLabel`を作成し`JToolTip`にその`JLabel`を追加 -- [[Timerでアニメーションするアイコンを作成>Swing/AnimeIcon]] #code{{ JLabel l1 = new JLabel("Timer Animated ToolTip") { @Override public JToolTip createToolTip() { JToolTip tip = new AnimatedToolTip(new AnimatedLabel("")); tip.setComponent(this); return tip; } }; l1.setToolTipText("dummy"); l1.setToolTipText(" "); }} - `Gif Animated ToolTip` -- `Animated GIF`ファイルを`JLabel#setIcon(Icon)`で設定し`JToolTip`にその`JLabel`を追加 #code{{ JLabel l2 = new JLabel("Gif Animated ToolTip") { @Override public JToolTip createToolTip() { JToolTip tip = new AnimatedToolTip( new JLabel("", new ImageIcon(url), SwingConstants.LEFT)); tip.setComponent(this); return tip; } }; }} - `Gif Animated ToolTip(html)` -- `Animated GIF`ファイルを`<html>`タグを使って`setToolTipText(...)`メソッドで設定 * 参考リンク [#reference] - [[JToolTipにアイコンを表示>Swing/ToolTipIcon]] - [[Timerでアニメーションするアイコンを作成>Swing/AnimeIcon]] - [[TrayIconのアニメーション>Swing/AnimatedTrayIcon]] * コメント [#comment] #comment #comment