Monday, October 1, 2012

Netbeans: Wrapping text in a jEditorPane (contained within a jScrollPane)

Problem: I've managed to set the content of my jEditorPane using the contentType property (which I simply changed from "text/plain" to "text/html") and the page property (for which I inserted "getClass().getResource("/file/path")" to the Custom code area). But now when I run the application, the jFrame is stretched wide and the text doesn't wrap.

Solution: Selecting the jScrollPane in the Navigator, you need merely to set the preferred size to 0,0 and it takes care of itself!

No comments:

Post a Comment