9 html java swing jtextarea jtextcomponent
当我尝试使用更改JTextArea的颜色时
textArea.setText("<html> <font color=\"red\"> Hi </font></html>")
Run Code Online (Sandbox Code Playgroud)
,文本显示基本上是整个文本写在setText方法中.但类似的事情适用于JLabel,JButton等.
我怎样才能为JTextArea做到这一点?
mKo*_*bel 23
不要JTextArea用于Html格式化Object(即使可能,但为什么要打扰)
use JTextPane/ JEditorPaneinstead(setContentType("text/html"))
注意,今天Java和Official API by Oracle支持的方法只能减少Html syntax with css <= Html 3.2
使用JavaFX在你想/需要使用今天的情况下Html5,
| 归档时间: |
|
| 查看次数: |
24307 次 |
| 最近记录: |