Skip to main content

How can I set text formatting in JEditorPane on the fly? A custom view?

No replies
Joined: 2009-09-28

I've been playing with the idea of implementing something like wikidpad[1]. The basic idea is that the user types in a text editor, and if the line they enter starts with, say, ++ it's renderd as a heading, if it starts with a * its an unordered list, etc.

I've been playing with a couple ways of doing this (I don't have any specific code worth sharing): I've poked into DocumentListeners & DocumentFilters, I've tried to look at implementing a custom ViewFactory (or at least extending one), and subclassing an EditorKit and setting AttributeSets on Elements, none of which has really panned out. Am I totally barking up the wrong tree?

If someone could set me on the right path, I'd be much obliged. Thanks.


fixed spelling errors
Message was edited by: decitrig