• 追加された行はこの色です。
  • 削除された行はこの色です。
TITLE:ToolTip表示の切り替え
#navi(../)
*ToolTip表示の切り替え [#m215229a]
>編集者:[[Terai Atsuhiro>terai]]~
作成日:2004-05-10~
更新日:&lastmod;

#contents

**概要 [#hb954f19]
ツールチップ((ツールヒント))表示の有無をToolTipManagerで切り替えます。

#screenshot

**サンプルコード [#p87749d9]
#code{{
 ActionListener al = new ActionListener() {
   public void actionPerformed(ActionEvent e) {
     JRadioButton radio = (JRadioButton) e.getSource();
     ToolTipManager.sharedInstance().setEnabled((radio==onRadio)?true:false);
   }
 };
 onRadio.addActionListener(al);
 offRadio.addActionListener(al);
ActionListener al = new ActionListener() {
  public void actionPerformed(ActionEvent e) {
    JRadioButton radio = (JRadioButton) e.getSource();
    ToolTipManager.sharedInstance().setEnabled((radio==onRadio)?true:false);
  }
};
onRadio.addActionListener(al);
offRadio.addActionListener(al);
}}
-&jnlp;
-&jar;
-&zip;

**解説 [#k939631f]
上記のサンプルでは、ボタンにツールチップを設定してあり、表示するかどうかをToolTipManagerを使って切り替えています。

ToolTipManagerは、アプリケーション全体でのツールチップの表示時間、表示までの遅延時間などを設定することができます。

//**参考リンク
**コメント [#v0898907]
#comment