I started using NetBeans today, and it was all going swimmingly, until I came upon this block.
I’m trying to make my jTextPane format any HTML i have in it. I’ve tried changing the Content type in the code with jTextPane1.setContentType("text/html"); but to no avail.
I’ve also tried changing the properties in the Design Window to relevant values, but no luck there either.
After some googling, I saw that Netbeans had a bug before that wouldn’t let text/html content be enabled properly, but it has been resolved a couple versions back.
Have any ideas how i can enable html in the panes? or even just another way to get hyperlinks working.
i use a JEditorPane for exact the same pupose.
Just set the ContentType to “text/html” as you allready do and you are good to go.
To include some predefined stylesheets i use this code:
You can use setEditable(false) so the HTML cant be changed.
Just tryed it with Netbeans 7.2 beta and it works the same way with an JTextPane.
Here is some more Docu about it:
http://docs.oracle.com/javase/tutorial/uiswing/components/editorpane.html#recap