Position « JTextPane « Java Swing Q&A





1. Method that returns the line number for a given JTextPane position?    stackoverflow.com

I'm looking for a method that computes the line number of a given text position in a JTextPane with wrapping enabled. Example:

This a very very very very very very very ...

2. Get style at caret position in a JTextPane    stackoverflow.com

I have a basic text editor that can style documents (bold, underline, italicize, underline, align left/right/center, color, font size/family), and that all works great. The problem I'm having is that I ...