HTMLEditorKit.ParserCallback

To parse an HTML file you write a subclass of
HTMLEditorKit.ParserCallback that responds to text
and tags as you desire. Then you pass an instance of your
subclass to the HTMLEditorKit.Parser's
parse() method along with the Reader
from which the HTML will be read: