In order to use different font colours, I need to use a JTextPane rather than a JTextArea.
So I've changed the JTextArea in my application to a JTextPane, and find that there is word wrapping where I didn't have any before. I want to turn all wrapping off and just use the scrollbars on the JScrollPane it's sitting on. How do I do this?
I found something here that includes a demo of about 150 lines of code that I don't really understand.
Maybe there's another way, getting the pane to grow automatically so that the text doesn't have to wrap, or something like that?
Here's a screenshot of my app (put together with the help of NetBeans' GUI builder). The text output is taken from another class as a single string with \n characters in it.
And here's what happens when I increase the length of the lines in the text to 160 columns:
Text Area Scrolling show how to turn on automatic scrolling for a text area. I would guess if you use the proper "update policy" you should be able to turn off scrolling for a text pane, but I've never tested it.