My program loads an RTF file and displays it in a JEditorPane with the following code:
public void ReadFile(String fileName) {
RTFEditorKit rtfKit = new RTFEditorKit();
StyledDocument doc = (StyledDocument) rtfKit.createDefaultDocument();
rcp.getJEditorPane().setEditorKit(rtfKit);
try {
FileInputStream fi = new FileInputStream("Document.rtf");
rtfKit.read(fi, doc, 0);
rcp.getJEditorPane().setDocument(doc);
} catch (FileNotFoundException e) {
System.out.println("File not found");
} catch (IOException e) {
System.out.println("I/O error");
} catch (BadLocationException e) {
}
}
Everything is going fine as long as I don't insert any indents, bulleted lists, or numbered lists in the original document. If the document does contain a one of these elements, all subsequent text is indented when displayed in the JEditorPane as well. It shows as follows:
1. This sentence is in the right position because it precedes the indent.
2. This sentence is indented in the original RTF.
3. This sentence and all other following sentences are not indented in the original RTF, but they become indented when displayed in the JEditorPane.
What I want is this:
1. This sentence is in the right position because contains no indent.
2. This sentence is indented in the original RTF.
3. This sentence would be in the right position if it were like this.
Any solution using a TextArea or a TextPane instead of an EditorPane would also suffice.
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
Use case: I receive a message from a source endpointDepending on the type of message, it gets handled by completely different business logic (e
I created a java web appWhen I run java -jar xxx
I'm struggling to understand 2D arrays and my exam is in 2 days, I've tried myself but I just can't get my head around it so this is basically my last resort and I really need help understanding them