java - html in JTextPane - strange box appear for tags -
i haven't used html in jtextpane before , playing today. come across strange output.
here simple code, htmlstr
contains contains tag <aa>
:
public class htmlinjtextpanetest extends jframe { private jtextpane jtp; private string htmlstr= "<html><body><b>what this</b> <aa > ?? </body></html>"; public htmlinjtextpanetest() { jtp = new jtextpane(); jtp.setcontenttype("text/html"); jtp.settext(htmlstr); //jtp.seteditable(false); //jframe setup add(jtp); setdefaultcloseoperation(jframe.exit_on_close); setsize(200, 100); setvisible(true); } public static void main(string[] args) { new htmlinjtextpanetest(); } }
the output of :
i don't know why box (seems input field) appeared tag name aa
in it?
it disappears when set editable false on jtextpane
object jtp
.
jtp.seteditable(false);
can please explain it?
you can use http://java-sl.com/custom_tag_html_kit.html example of custom tag support in htmleditorkit
.
Comments
Post a Comment