Can i use html with JTextArea?
i try
textArea.setText("<html><b>something</b></html>");
but it only show html code
Can i use html with JTextArea?
thanks.
PS:
another problem: how made JTextarea autoscroll when i append text for it?
Message was edited by:
NhTin
[337 byte] By [
NhTina] at [2007-11-26 17:14:48]

# 2
i found JEditorPane can show html code,
i try use
JEditorPane editor = new JEditorPane();
editor.setContentType("text/html");
editor.setText("<b>asdasd</b>");
it ok, but when i tried 2 way to append text:
1.
editor.setText(editor.getText()+"<b>asdasd</b>");
2.
String html = editor.getText();
editor.setText(html+"<b>asdasd</b>");
it show a blank screen, nothing on it
how can i do to append text/html to JEditorPane?
thanks
Message was edited by:
NhTin
# 3
Don't know what you exact requirement is, but I find it easier to work with attributes than with HTML:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=342068
> another problem: how made JTextarea autoscroll when i append text for it?
textComponent.setCaretPosition( textComponent.getDocument().getLength() );