Tp EnumParas

// Create a text pane
JTextPane textPane = new JTextPane();

// Get section element
Element section = textPane.getDocument().getDefaultRootElement();

// Get number of paragraphs.
// In a text pane, a span of characters terminated by single
// newline is typically called a paragraph.
int paraCount = section.getElementCount();

// Get index ranges for each paragraph
for (int i=0; i<paraCount; i++) {
    Element e = section.getElement(i);
    int rangeStart = e.getStartOffset();
    int rangeEnd = e.getEndOffset();
    try {
        String para = textPane.getText(rangeStart, rangeEnd-rangeStart);
    } catch (BadLocationException ex) {

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.