DefaultStyledDocument.SectionElement (Java SE 26 & JDK 26)
Description: declaration: module: java.desktop, package: javax.swing.text, class: DefaultStyledDocument, class: SectionElement
Keywords: javax.swing.text.DefaultStyledDocument.SectionElement class

# Class DefaultStyledDocument.SectionElement

java.lang.Object
javax.swing.text.AbstractDocument.AbstractElement
javax.swing.text.AbstractDocument.BranchElement
javax.swing.text.DefaultStyledDocument.SectionElement

All Implemented Interfaces:
  `Serializable, AttributeSet, Element, MutableAttributeSet, TreeNode`

Enclosing class:
  `DefaultStyledDocument`

protected class DefaultStyledDocument.SectionElement extends AbstractDocument.BranchElement
Default root element for a document... maps out the paragraphs/lines contained.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans has been added to the `java.beans` package. Please see `XMLEncoder`.

- ## Nested Class Summary

  ### Nested classes/interfaces declared in interface AttributeSet

  `AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute`
  Modifier and Type
  Interface
  Description
  `static interface`
  `AttributeSet.CharacterAttribute`
  This interface is the type signature that is expected to be present on any attribute key that contributes to character level presentation.
  `static interface`
  `AttributeSet.ColorAttribute`
  This interface is the type signature that is expected to be present on any attribute key that contributes to presentation of color.
  `static interface`
  `AttributeSet.FontAttribute`
  This interface is the type signature that is expected to be present on any attribute key that contributes to the determination of what font to use to render some text.
  `static interface`
  `AttributeSet.ParagraphAttribute`
  This interface is the type signature that is expected to be present on any attribute key that contributes to the paragraph level presentation.

- ## Field Summary

  ### Fields declared in interface AttributeSet

  `NameAttribute, ResolveAttribute`
  Modifier and Type
  Field
  Description
  `static final Object`
  `NameAttribute`
  Attribute name used to name the collection of attributes.
  `static final Object`
  `ResolveAttribute`
  Attribute name used to identify the resolving parent set of attributes, if one is defined.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SectionElement()`
  Creates a new SectionElement.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getName()`
  Gets the name of the element.

  ### Methods declared in class AbstractDocument.BranchElement

  `children, getAllowsChildren, getElement, getElementCount, getElementIndex, getEndOffset, getStartOffset, isLeaf, positionToElement, replace, toString`
  Modifier and Type
  Method
  Description
  `Enumeration<TreeNode>`
  `children()`
  Returns the children of the receiver as an `Enumeration`.
  `boolean`
  `getAllowsChildren()`
  Returns true if the receiver allows children.
  `Element`
  `getElement(int index)`
  Gets a child element.
  `int`
  `getElementCount()`
  Gets the number of children for the element.
  `int`
  `getElementIndex(int offset)`
  Gets the child element index closest to the given model offset.
  `int`
  `getEndOffset()`
  Gets the ending offset in the model for the element.
  `int`
  `getStartOffset()`
  Gets the starting offset in the model for the element.
  `boolean`
  `isLeaf()`
  Checks whether the element is a leaf.
  `Element`
  `positionToElement(int pos)`
  Gets the child element that contains the given model position.
  `void`
  `replace(int offset, int length, Element[] elems)`
  Replaces content with a new set of elements.
  `String`
  `toString()`
  Converts the element to a string.

  ### Methods declared in class AbstractDocument.AbstractElement

  `addAttribute, addAttributes, containsAttribute, containsAttributes, copyAttributes, dump, getAttribute, getAttributeCount, getAttributeNames, getAttributes, getChildAt, getChildCount, getDocument, getIndex, getParent, getParentElement, getResolveParent, isDefined, isEqual, removeAttribute, removeAttributes, removeAttributes, setResolveParent`
  Modifier and Type
  Method
  Description
  `void`
  `addAttribute(Object name, Object value)`
  Adds an attribute to the element.
  `void`
  `addAttributes(AttributeSet attr)`
  Adds a set of attributes to the element.
  `boolean`
  `containsAttribute(Object name, Object value)`
  Checks whether a given attribute name/value is defined.
  `boolean`
  `containsAttributes(AttributeSet attrs)`
  Checks whether the element contains all the attributes.
  `AttributeSet`
  `copyAttributes()`
  Copies a set of attributes.
  `void`
  `dump(PrintStream psOut, int indentAmount)`
  Dumps a debugging representation of the element hierarchy.
  `Object`
  `getAttribute(Object attrName)`
  Gets the value of an attribute.
  `int`
  `getAttributeCount()`
  Gets the number of attributes that are defined.
  `Enumeration<?>`
  `getAttributeNames()`
  Gets the names of all attributes.
  `AttributeSet`
  `getAttributes()`
  Gets the attributes for the element.
  `TreeNode`
  `getChildAt(int childIndex)`
  Returns the child `TreeNode` at index `childIndex`.
  `int`
  `getChildCount()`
  Returns the number of children `TreeNode`'s receiver contains.
  `Document`
  `getDocument()`
  Retrieves the underlying model.
  `int`
  `getIndex(TreeNode node)`
  Returns the index of `node` in the receivers children.
  `TreeNode`
  `getParent()`
  Returns the parent `TreeNode` of the receiver.
  `Element`
  `getParentElement()`
  Gets the parent of the element.
  `AttributeSet`
  `getResolveParent()`
  Gets the resolving parent.
  `boolean`
  `isDefined(Object attrName)`
  Checks whether a given attribute is defined.
  `boolean`
  `isEqual(AttributeSet attr)`
  Checks whether two attribute sets are equal.
  `void`
  `removeAttribute(Object name)`
  Removes an attribute from the set.
  `void`
  `removeAttributes(Enumeration<?> names)`
  Removes a set of attributes for the element.
  `void`
  `removeAttributes(AttributeSet attrs)`
  Removes a set of attributes for the element.
  `void`
  `setResolveParent(AttributeSet parent)`
  Sets the resolving parent.

  ### Methods declared in class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  Creates and returns a copy of this object.
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `protected void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization is deprecated and subject to removal in a future release.
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `int`
  `hashCode()`
  Returns a hash code value for this object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Constructor Details

  - ### SectionElement

    public SectionElement()
    Creates a new SectionElement.

- ## Method Details

  - ### getName

    public String getName()
    Gets the name of the element.
    Specified by:
      `getName` in interface `Element`
    Overrides:
      `getName` in class `AbstractDocument.BranchElement`
    Returns:
      the name