javax.swing.text

Class DefaultStyledDocument.ElementBuffer

    • Constructor Detail

      • DefaultStyledDocument.ElementBuffer

        public DefaultStyledDocument.ElementBuffer(Element root)
        Creates a new ElementBuffer for the specified root element.
        Parameters:
        root - the root element for this ElementBuffer
    • Method Detail

      • getRootElement

        public Element getRootElement()
        Returns the root element of this ElementBuffer.
        Returns:
        the root element of this ElementBuffer
      • remove

        public void remove(int offs,
                  int len,
                  AbstractDocument.DefaultDocumentEvent ev)
        Removes the content. This method sets some internal parameters and delegates the work to removeUpdate().
        Parameters:
        offs - the offset from which content is remove
        len - the length of the removed content
        ev - the document event that records the changes
      • removeUpdate

        protected void removeUpdate()
        Updates the element structure of the document in response to removal of content. It removes the affected Elements from the document structure.
      • change

        public void change(int offset,
                  int length,
                  AbstractDocument.DefaultDocumentEvent ev)
        Modifies the element structure so that the specified interval starts and ends at an element boundary. Content and paragraph elements are split and created as necessary. This also updates the DefaultDocumentEvent to reflect the structural changes. The bulk work is delegated to changeUpdate().
        Parameters:
        offset - the start index of the interval to be changed
        length - the length of the interval to be changed
        ev - the DefaultDocumentEvent describing the change
      • clone

        public Element clone(Element parent,
                    Element clonee)
        Creates and returns a deep clone of the specified clonee with the specified parent as new parent. This method can only clone direct instances of BranchElement or LeafElement.
        Parameters:
        parent - the new parent
        clonee - the element to be cloned
        Returns:
        the cloned element with the new parent