Help on writing your own javax.swing.text.Document
        Posted  
        
            by DJClayworth
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by DJClayworth
        
        
        
        Published on 2010-03-25T15:05:52Z
        Indexed on 
            2010/03/25
            16:03 UTC
        
        
        Read the original article
        Hit count: 369
        
I'm writing a Java TextComponent where the underlying document has some structure. It is very short, basically one line. I need to be able to override the response to inserting or deleting characters in some parts of the document.
My initial approach was to implement javax.swing.text.Document, but this seems to involve developing many associated classes (Element, EditorKit, View) and there don't seem to be many examples or tutorials on how to do this. There are plenty on using the pre-defined implementations.
Can anyone point me at tutorials or other aids for simple implementations of Document and what other classes I need to create to make this work.
© Stack Overflow or respective owner