jtextpane

Read JTextPane line by line

Is there a way to read the contents of a JTextPane line by line? Much like the BufferedReader? ...

JTextPane editor large file & performance

Hi, I'm using a JTextPane to edit XML files. A jflex parser split xml file in tokens and using a custom document (extends DefaultStyledDocument) i color syntax: doc.setCharacterAttributes(token.getCharBegin() + change, token.getCharEnd() - token.getCharBegin(), Token_Styles_Define.getStyle(token.getDescription()), true); My p...

Inserting inline JComponents into a JTextPane?

Hello, I'm working on a project that needs to be able to have JComponents inserted into a JTextPane, along with normal text. Currently, I'm using JTextPane.insertComponent(Component) to add the JComponents, however, they seem to be added sporadically with no real organization. I finally figured out that it's inserting it wherever the car...

Style a JTextPane to have console-like formatting?

Is there a way to make the text in a JTextPane look similar to that of console output? By that I mean, basically, how each character is the same width, so that things like ASCII art, or spacing indentation would work correctly. For example, currently, if I type "First" and then 5 spaces, and then on a new line "Second" and then 4 spaces...

Correctly print out a hard copy of a JTextPane with "text/rtf" content

I'm trying to print out some simple RTF-formatted text to a laser printer using a JTextPane. The result looks fine on a software PDF printer (FreePDF XP), but the text doesn't have proper space between it's formatted parts when print to a real printer. Edit: I have uploaded an example output (The bottom is the scanned printout) It s...

Adding text to a JTextPane without having it editable by the user?

So I've created my own text pane class (extending JTextPane) and I'm using the method below to add text to it. However, the pane needs to be editable for it to add the text, but this allows a user to edit what is in the pane as well. Can anyone tell me how to add text to the pane without letting the user manipulate what is there? publi...