Class SwingContent

  • All Implemented Interfaces:
    javax.swing.text.AbstractDocument.Content

    public class SwingContent
    extends java.lang.Object
    implements javax.swing.text.AbstractDocument.Content
    A wrapper around a CharBuffer that implements Swing's Content. This allows us to use a CharBuffer for a Document's Content.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.swing.text.Position createPosition​(int offset)  
      void getChars​(int where, int len, javax.swing.text.Segment txt)  
      java.lang.String getString​(int where, int len)  
      javax.swing.undo.UndoableEdit insertString​(int where, java.lang.String str)  
      javax.swing.undo.UndoableEdit insertString​(int where, java.lang.String str, boolean beforeMarkers)  
      int length()  
      javax.swing.undo.UndoableEdit remove​(int where, int nitems)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SwingContent

        public SwingContent​(CharBuffer buffer)
      • SwingContent

        public SwingContent​(int initialSize)
      • SwingContent

        public SwingContent()
    • Method Detail

      • length

        public int length()
        Specified by:
        length in interface javax.swing.text.AbstractDocument.Content
      • getChars

        public void getChars​(int where,
                             int len,
                             javax.swing.text.Segment txt)
                      throws javax.swing.text.BadLocationException
        Specified by:
        getChars in interface javax.swing.text.AbstractDocument.Content
        Throws:
        javax.swing.text.BadLocationException
      • getString

        public java.lang.String getString​(int where,
                                          int len)
                                   throws javax.swing.text.BadLocationException
        Specified by:
        getString in interface javax.swing.text.AbstractDocument.Content
        Throws:
        javax.swing.text.BadLocationException
      • remove

        public javax.swing.undo.UndoableEdit remove​(int where,
                                                    int nitems)
                                             throws javax.swing.text.BadLocationException
        Specified by:
        remove in interface javax.swing.text.AbstractDocument.Content
        Throws:
        javax.swing.text.BadLocationException
      • insertString

        public javax.swing.undo.UndoableEdit insertString​(int where,
                                                          java.lang.String str,
                                                          boolean beforeMarkers)
                                                   throws javax.swing.text.BadLocationException
        Throws:
        javax.swing.text.BadLocationException
      • insertString

        public javax.swing.undo.UndoableEdit insertString​(int where,
                                                          java.lang.String str)
                                                   throws javax.swing.text.BadLocationException
        Specified by:
        insertString in interface javax.swing.text.AbstractDocument.Content
        Throws:
        javax.swing.text.BadLocationException
      • createPosition

        public javax.swing.text.Position createPosition​(int offset)
                                                 throws javax.swing.text.BadLocationException
        Specified by:
        createPosition in interface javax.swing.text.AbstractDocument.Content
        Throws:
        javax.swing.text.BadLocationException