Swing/AnimatedToolTip のバックアップ(No.7)
- バックアップ一覧
 - 差分 を表示
 - 現在との差分 を表示
 - 現在との差分 - 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)
 - 13 (2024-06-30 (日) 02:37:58)
 - 14 (2025-01-03 (金) 08:57:02)
 - 15 (2025-01-03 (金) 09:01:23)
 - 16 (2025-01-03 (金) 09:02:38)
 - 17 (2025-01-03 (金) 09:03:21)
 - 18 (2025-01-03 (金) 09:04:02)
 - 19 (2025-06-19 (木) 12:41:37)
 - 20 (2025-06-19 (木) 12:43:47)
 
 
- category: swing
folder: AnimatedToolTip
title: JToolTipのアニメーション
tags: [JToolTip, JLabel, Animation, Html]
author: aterai
pubdate: 2007-04-23T09:48:54+09:00
description: JToolTipが表示されたとき、内部のJLabelでアイコンのアニメーションを行う方法をテストします。
image: 

 
概要
JToolTipが表示されたとき、内部のJLabelでアイコンのアニメーションを行う方法をテストします。
Screenshot

Advertisement
サンプルコード
JLabel l3 = new JLabel("Gif Animated ToolTip(html)");
l3.setToolTipText("<html><img src='" + url + "'>Test3</html>");
View in GitHub: Java, Kotlin解説
- 上
javax.swing.Timerを使ってアニメーションを行うJLabelを作成し、JToolTipにそのJLabelを追加- Timerでアニメーションするアイコンを作成
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"); 
 - 中
Animated GIFファイルをJLabel#setIcon(Icon)で設定し、JToolTipにそのJLabelを追加
 - 下
Animated GIFファイルを<html>タグを使ってsetToolTipText(...)メソッドで設定