When I try to change color of a JTextArea using
textArea.setText(\" Hi \")
<
don't to use JTextArea
for Html
formatted Object
(even is possible, but why bothering)
use JTextPane
/ JEditorPane
instead (setContentType("text/html"))
notice, todays Java and methods implemented in Official API by Oracle
supporting only reduced Html syntax with css <= Html 3.2
use JavaFX
in the case that you want/need to use todays Html5
,
JavaFX WebView is very powerful for rendering HTML and You can easily display javafx component(WebView) in your Swing Application by using JFXPanel. For tutorial of embedding fx in swing here is one from oracle: http://docs.oracle.com/javafx/2/swing/swing-fx-interoperability.htm
Thanks