Swing/HtmlDisable のバックアップ差分(No.1)
- バックアップ一覧
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- バックアップ を表示
- Swing/HtmlDisable へ行く。
- 追加された行はこの色です。
- 削除された行はこの色です。
TITLE:JLabelなどのHtmlレンダリングを無効化 #navi(../) *JLabelなどのHtmlレンダリングを無効化 [#w86356de] Posted by [[terai]] at 2008-04-21 #contents **概要 [#qcd078d5] JLabelなどのHtmlレンダリングを無効化して、タグ文字列をそのまま表示します。 -&jnlp; -&jar; -&zip; #screenshot **サンプルコード [#l921f158] #code{{ label1.putClientProperty("html.disable", Boolean.TRUE); label1.setText("<html><font color=red>Html Test</font></html>"); label1.setToolTipText("<html><html><font color=red>Html Test</font></html></html>"); }} **解説 [#w8cdc1ca] 上記のサンプルでは、JLabelなどにputClientProperty("html.disable", Boolean.TRUE)を設定することで、タグをレンダリングせずにそのまま文字列として表示しています。 ---- putClientProperty("html.disable", Boolean.TRUE)としても、ToolTipには反映されないので、<html>タグの中で文字実体参照を使っています。 //**参考リンク **コメント [#n441a4f7] #comment