Questions tagged [styleddocument]

`StyledDocument` is a Java interface that extends `Document`. It helps Swing Components like `JTextPane` to render HTML and other markup-language-content.

StyledDocument is a Java interface, extending Document, to help Swing Components like JTextPane that supports the javax.swing.text API to render HTML and other markup-language content. From the JavaDoc it just says:

Interface for a generic styled document.

You normally don't handle with this interface, Methods like JEditorPane.setContentPane() automatically installs the required StyledDocument on your Component.

65 questions
0
votes
3 answers

Java Library to load a document and tag parts of text

I am new to Swing development and I am creating a Java application where a user can load text documents and tag parts of text. The tagged parts of text would then be highlighted and the user can click on the tagged text to edit/remove the tag. Is…
Ankit
  • 6,772
  • 11
  • 48
  • 84
-1
votes
1 answer

Compare a short and a long string in JTextPane and write characters of the long string in an other color

I hope you can help me to solve my Problem. I have two Strings and both are nearly equal. String A is like: "Hello my friend" String B is like: "Hello! my! friend" Now I want to compare both Strings and write the result into another String. The…
morlog47
  • 7
  • 2
-1
votes
1 answer

Getting the font letter and color from a Styled Document/Text Pane

Lately I have been using Style Constants, Styled Documents and Text Pane. I know that you can edit a part of the text that you highlight/select showing it in the code below StyledDocument doc = this.tpText.getStyledDocument(); Style…
-2
votes
1 answer

Null Pointer Exception Issue

I made an instant messenger at first using a JTextArea called chatWindow. I changed it to a JTextPane later on. After adding my styling attributes, I got a null pointer exception in the console of eclipse. Here is my code for the constructor and…
-3
votes
1 answer

Custom tabs in jtextarea in java

How to set tab stops in jtextarea for different lengths, first tab should stop 4 Second tab should stop at 20 (If i give tab from 4 it should stop at 20) Third tab should stop at 30 (If i give tab from 0 it should stop at 30)
FirmView
  • 3,130
  • 8
  • 34
  • 50
1 2 3 4
5