• 追加された行はこの色です。
  • 削除された行はこの色です。
TITLE:JToolTipにBorderを設定
#navi(../)
#tags()
RIGHT:Posted by &author(aterai); at 2005-08-15
*JToolTipにBorderを設定 [#kfc70601]
ツールチップにBorderを設定します。
---
title: JToolTipにBorderを設定
tags: [JToolTip, Border]
author: aterai
pubdate: 2005-08-15
description: ツールチップにBorderを設定します。
---
* 概要 [#kfc70601]
ツールチップに`Border`を設定します。

-&jnlp;
-&jar;
-&zip;
#download(https://lh6.googleusercontent.com/_9Z4BYR88imo/TQTVjcQsX6I/AAAAAAAAAn0/tieki8bniAM/s800/ToolTipBorder.png)

//#screenshot
#ref(http://lh6.ggpht.com/_9Z4BYR88imo/TQTVjcQsX6I/AAAAAAAAAn0/tieki8bniAM/s800/ToolTipBorder.png)

**サンプルコード [#hae3c35e]
* サンプルコード [#hae3c35e]
#code(link){{
JButton button = new JButton() {
  public JToolTip createToolTip() {
    JToolTip tip = new JToolTip();
    Border b1 = tip.getBorder();
    Border b2 = BorderFactory.createMatteBorder(0,10,0,0,Color.GREEN);
    tip.setBorder(BorderFactory.createCompoundBorder(b1, b2));
    tip.setComponent(this);
    return tip;
  }
};
button.setToolTipText("テスト");
}}

**解説 [#mf29af77]
上記のサンプルでは、JComponent#createToolTipメソッドをオーバーライドし、その中でBorderを設定したJToolTipを生成しています。
* 解説 [#mf29af77]
上記のサンプルでは、`JComponent#createToolTip`メソッドをオーバーライドし、その中で`Border`を設定した`JToolTip`を生成しています。

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