The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

This topic is READ ONLY
import-bot (20211) [Avatar] Offline
[Originally posted by svoboda]

I'm just now getting used to Java/Swing, and my first problem is a doozy:
I want to create a text editor (easy) that keeps track of sentences...that
is, strings that end with a period '.'. (We all know that this is an overly
simple model for sentences, but this is just for starters.)

So I was figuring the way to do this is to use a JTextArea (don't need any
styles) and subclass the AbstractDocument class. I figure the Right Thing here
involves managing Elements differently than the PlainDocument class (it seems
to equate elements with lines-of-text, not sentences.)
But I can't find any examples that play with Elements, and the documentation
on Elements is sparse; I have only ascertained that Elements are probably
the Right Thing. Are there any tutorials or code examples that use Elements
in some manner other than lines or paragraphs?