## Uses of Interface
javax.swing.text.Element

- Packages that use Element
  Package | Description
  --- | ---
  javax.swing | Provides a set of "lightweight" (all-Java language) components that, to the maximum degree possible, work the same on all platforms.
  javax.swing.event | Provides for events fired by Swing components.
  javax.swing.plaf.basic | Provides user interface objects built according to the Basic look and feel.
  javax.swing.plaf.synth | Synth is a skinnable look and feel in which all painting is delegated.
  javax.swing.text | Provides classes and interfaces that deal with editable and noneditable text components.
  javax.swing.text.html | Provides the class `HTMLEditorKit` and supporting classes for creating HTML text editors.

- - ### Uses of Element in javax.swing

    Constructors in javax.swing with parameters of type Element
    Constructor | Description
    --- | ---
    `HTMLLink(Element e)`

  - ### Uses of Element in javax.swing.event

    Methods in javax.swing.event that return Element
    Modifier and Type | Method | Description
    --- | --- | ---
    `Element[]` | DocumentEvent.ElementChange.`getChildrenAdded()` Gets the child elements that were added to the given parent element.
    `Element[]` | DocumentEvent.ElementChange.`getChildrenRemoved()` Gets the child elements that were removed from the given parent element.
    `Element` | DocumentEvent.ElementChange.`getElement()` Returns the element represented.
    `Element` | HyperlinkEvent.`getSourceElement()` Returns the `Element` that corresponds to the source of the event.

    Methods in javax.swing.event with parameters of type Element
    Modifier and Type | Method | Description
    --- | --- | ---
    `DocumentEvent.ElementChange` | DocumentEvent.`getChange(Element elem)` Gets the change information for the given element.

    Constructors in javax.swing.event with parameters of type Element
    Constructor | Description
    --- | ---
    `HyperlinkEvent(Object source, HyperlinkEvent.EventType type, URL u, String desc, Element sourceElement)` Creates a new object representing a hypertext link event.
    `HyperlinkEvent(Object source, HyperlinkEvent.EventType type, URL u, String desc, Element sourceElement, InputEvent inputEvent)` Creates a new object representing a hypertext link event.

  - ### Uses of Element in javax.swing.plaf.basic

    Methods in javax.swing.plaf.basic with parameters of type Element
    Modifier and Type | Method | Description
    --- | --- | ---
    `View` | BasicTextAreaUI.`create(Element elem)` Creates the view for an element.
    `View` | BasicTextFieldUI.`create(Element elem)` Creates a view (FieldView) based on an element.
    `View` | BasicPasswordFieldUI.`create(Element elem)` Creates a view (PasswordView) for an element.
    `View` | BasicTextUI.`create(Element elem)` Creates a view for an element.
    `View` | BasicTextUI.`create(Element elem, int p0, int p1)` Creates a view for an element.

  - ### Uses of Element in javax.swing.plaf.synth

    Methods in javax.swing.plaf.synth with parameters of type Element
    Modifier and Type | Method | Description
    --- | --- | ---
    `View` | SynthPasswordFieldUI.`create(Element elem)` Creates a view (PasswordView) for an element.

  - ### Uses of Element in javax.swing.text

    Classes in javax.swing.text that implement Element
    Modifier and Type | Class | Description
    --- | --- | ---
    `class` | `AbstractDocument.AbstractElement` Implements the abstract part of an element.
    `class` | `AbstractDocument.BranchElement` Implements a composite element that contains other elements.
    `class` | `AbstractDocument.LeafElement` Implements an element that directly represents content of some kind.
    `protected class` | `DefaultStyledDocument.SectionElement` Default root element for a document...

    Fields in javax.swing.text declared as Element
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected Element` | DefaultStyledDocument.AttributeUndoableEdit.`element`

    Methods in javax.swing.text that return Element
    Modifier and Type | Method | Description
    --- | --- | ---
    `Element` | DefaultStyledDocument.ElementBuffer.`clone(Element parent, Element clonee)` Creates a copy of this element, with a different parent.
    `protected Element` | AbstractDocument.`createBranchElement(Element parent, AttributeSet a)` Creates a document branch element, that can contain other elements.
    `protected Element` | AbstractDocument.`createLeafElement(Element parent, AttributeSet a, int p0, int p1)` Creates a document leaf element.
    `Element` | ElementIterator.`current()` Fetches the current Element.
    `Element` | ElementIterator.`first()` Fetches the first element.
    `Element` | AbstractDocument.`getBidiRootElement()` Returns the root element of the bidirectional structure for this document.
    `Element` | StyledEditorKit.`getCharacterAttributeRun()` Fetches the element representing the current run of character attributes for the caret.
    `Element` | StyledDocument.`getCharacterElement(int pos)` Gets the element that represents the character that is at the given offset within the document.
    `Element` | DefaultStyledDocument.`getCharacterElement(int pos)` Gets a character element based on a position.
    `Element[]` | AbstractDocument.ElementEdit.`getChildrenAdded()` Gets a list of children that were added.
    `Element[]` | AbstractDocument.ElementEdit.`getChildrenRemoved()` Gets a list of children that were removed.
    `Element` | PlainDocument.`getDefaultRootElement()` Gets the default root element for the document model.
    `abstract Element` | AbstractDocument.`getDefaultRootElement()` Returns the root element that views should be based upon unless some other mechanism for assigning views to element structures is provided.
    `Element` | DefaultStyledDocument.`getDefaultRootElement()` Gets the default root element.
    `Element` | Document.`getDefaultRootElement()` Returns the root element that views should be based upon, unless some other mechanism for assigning views to element structures is provided.
    `Element` | AbstractDocument.ElementEdit.`getElement()` Returns the underlying element.
    `Element` | View.`getElement()` Fetches the structural portion of the subject that this view is mapped to.
    `abstract Element` | AbstractDocument.AbstractElement.`getElement(int index)` Gets a child element.
    `Element` | AbstractDocument.BranchElement.`getElement(int index)` Gets a child element.
    `Element` | AbstractDocument.LeafElement.`getElement(int index)` Gets a child element.
    `Element` | Element.`getElement(int index)` Fetches the child element at the given index.
    `Element` | PlainDocument.`getParagraphElement(int pos)` Get the paragraph element containing the given position.
    `Element` | StyledDocument.`getParagraphElement(int pos)` Gets the element that represents the paragraph that encloses the given offset within the document.
    `abstract Element` | AbstractDocument.`getParagraphElement(int pos)` Get the paragraph element containing the given position.
    `Element` | DefaultStyledDocument.`getParagraphElement(int pos)` Gets the paragraph element at the offset `pos`.
    `static Element` | Utilities.`getParagraphElement(JTextComponent c, int offs)` Determines the element to use for a paragraph/line.
    `Element` | AbstractDocument.AbstractElement.`getParentElement()` Gets the parent of the element.
    `Element` | Element.`getParentElement()` Fetches the parent element.
    `Element` | DefaultStyledDocument.ElementBuffer.`getRootElement()` Gets the root element.
    `Element[]` | AbstractDocument.`getRootElements()` Gets all root elements defined.
    `Element[]` | Document.`getRootElements()` Returns all of the root elements that are defined.
    `Element` | ElementIterator.`next()` Fetches the next Element.
    `Element` | AbstractDocument.BranchElement.`positionToElement(int pos)` Gets the child element that contains the given model position.
    `Element` | ElementIterator.`previous()` Fetches the previous Element.

    Methods in javax.swing.text with parameters of type Element
    Modifier and Type | Method | Description
    --- | --- | ---
    `Element` | DefaultStyledDocument.ElementBuffer.`clone(Element parent, Element clonee)` Creates a copy of this element, with a different parent.
    `View` | ViewFactory.`create(Element elem)` Creates a view from the given structural element of a document.
    `protected Element` | AbstractDocument.`createBranchElement(Element parent, AttributeSet a)` Creates a document branch element, that can contain other elements.
    `protected void` | StyledEditorKit.`createInputAttributes(Element element, MutableAttributeSet set)` Copies the key/values in `element`s AttributeSet into `set`.
    `protected Element` | AbstractDocument.`createLeafElement(Element parent, AttributeSet a, int p0, int p1)` Creates a document leaf element.
    `protected TableView.TableCell` | TableView.`createTableCell(Element elem)` Deprecated. Table cells can now be any arbitrary View implementation and should be produced by the ViewFactory rather than the table.
    `protected TableView.TableRow` | TableView.`createTableRow(Element elem)` Creates a new table row.
    `DocumentEvent.ElementChange` | AbstractDocument.DefaultDocumentEvent.`getChange(Element elem)` Gets the changes for an element.
    `protected String` | AbstractWriter.`getText(Element elem)` Returns the text associated with the element.
    `protected boolean` | AbstractWriter.`inRange(Element next)` This method determines whether the current element is in the range specified.
    `void` | DefaultStyledDocument.`removeElement(Element elem)` Removes an element from this document.
    `void` | AbstractDocument.BranchElement.`replace(int offset, int length, Element[] elems)` Replaces content with a new set of elements.
    `protected void` | AbstractWriter.`text(Element elem)` Writes out text.

    Constructors in javax.swing.text with parameters of type Element
    Constructor | Description
    --- | ---
    `AbstractElement(Element parent, AttributeSet a)` Creates a new AbstractElement.
    `AbstractWriter(Writer w, Element root)` Creates a new AbstractWriter.
    `AbstractWriter(Writer w, Element root, int pos, int len)` Creates a new AbstractWriter.
    `AsyncBoxView(Element elem, int axis)` Construct a box view that does asynchronous layout.
    `AttributeUndoableEdit(Element element, AttributeSet newAttributes, boolean isReplacing)`
    `BoxView(Element elem, int axis)` Constructs a `BoxView`.
    `BranchElement(Element parent, AttributeSet a)` Constructs a composite element that initially contains no children.
    `ComponentView(Element elem)` Creates a new ComponentView object.
    `CompositeView(Element elem)` Constructs a `CompositeView` for the given element.
    `ElementBuffer(Element root)` Creates a new ElementBuffer.
    `ElementEdit(Element e, int index, Element[] removed, Element[] added)` Constructs an edit record.
    `ElementEdit(Element e, int index, Element[] removed, Element[] added)` Constructs an edit record.
    `ElementEdit(Element e, int index, Element[] removed, Element[] added)` Constructs an edit record.
    `ElementIterator(Element root)` Creates a new ElementIterator.
    `FieldView(Element elem)` Constructs a new FieldView wrapped on an element.
    `FlowView(Element elem, int axis)` Constructs a FlowView for the given element.
    `GlyphView(Element elem)` Constructs a new view wrapped on an element.
    `IconView(Element elem)` Creates a new icon view that represents an element.
    `LabelView(Element elem)` Constructs a new view wrapped on an element.
    `LeafElement(Element parent, AttributeSet a, int offs0, int offs1)` Constructs an element that represents content within the document (has no children).
    `ParagraphView(Element elem)` Constructs a `ParagraphView` for the given element.
    `PasswordView(Element elem)` Constructs a new view wrapped on an element.
    `PlainView(Element elem)` Constructs a new PlainView wrapped on an element.
    `TableCell(Element elem)` Deprecated. Constructs a TableCell for the given element.
    `TableRow(Element elem)` Constructs a TableView for the given element.
    `TableView(Element elem)` Constructs a TableView for the given element.
    `View(Element elem)` Creates a new `View` object.
    `WrappedPlainView(Element elem)` Creates a new WrappedPlainView.
    `WrappedPlainView(Element elem, boolean wordWrap)` Creates a new WrappedPlainView.
    `ZoneView(Element elem, int axis)` Constructs a ZoneView.

  - ### Uses of Element in javax.swing.text.html

    Classes in javax.swing.text.html that implement Element
    Modifier and Type | Class | Description
    --- | --- | ---
    `class` | `HTMLDocument.BlockElement` An element that represents a structural block of HTML.
    `class` | `HTMLDocument.RunElement` An element that represents a chunk of text that has a set of HTML character level attributes assigned to it.

    Methods in javax.swing.text.html that return Element
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected Element` | HTMLDocument.`createBranchElement(Element parent, AttributeSet a)` Creates a document branch element, that can contain other elements.
    `protected Element` | HTMLDocument.`createLeafElement(Element parent, AttributeSet a, int p0, int p1)` Creates a document leaf element that directly represents text (doesn't have any children).
    `protected Element` | HTMLEditorKit.HTMLTextAction.`findElementMatchingTag(HTMLDocument doc, int offset, HTML.Tag tag)` Returns the deepest element at `offset` matching `tag`.
    `Element` | HTMLDocument.`getElement(Element e, Object attribute, Object value)` Returns the child element of `e` that contains the attribute, `attribute` with value `value`, or `null` if one isn't found.
    `Element` | HTMLDocument.`getElement(String id)` Returns the element that has the given id `Attribute`.
    `protected Element[]` | HTMLEditorKit.HTMLTextAction.`getElementsAt(HTMLDocument doc, int offset)` Returns an array of the Elements that contain `offset`.

    Methods in javax.swing.text.html with parameters of type Element
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | HTMLWriter.`comment(Element elem)` Writes out comments.
    `View` | HTMLEditorKit.HTMLFactory.`create(Element elem)` Creates a view from an element.
    `protected Element` | HTMLDocument.`createBranchElement(Element parent, AttributeSet a)` Creates a document branch element, that can contain other elements.
    `protected void` | HTMLEditorKit.`createInputAttributes(Element element, MutableAttributeSet set)` Copies the key/values in `element`s AttributeSet into `set`.
    `protected Element` | HTMLDocument.`createLeafElement(Element parent, AttributeSet a, int p0, int p1)` Creates a document leaf element that directly represents text (doesn't have any children).
    `protected void` | HTMLWriter.`emptyTag(Element elem)` Writes out all empty elements (all tags that have no corresponding end tag).
    `protected void` | HTMLWriter.`endTag(Element elem)` Writes out an end tag for the element.
    `Element` | HTMLDocument.`getElement(Element e, Object attribute, Object value)` Returns the child element of `e` that contains the attribute, `attribute` with value `value`, or `null` if one isn't found.
    `Style` | StyleSheet.`getRule(HTML.Tag t, Element e)` Fetches the style to use to render the given type of HTML tag.
    `void` | HTMLDocument.`insertAfterEnd(Element elem, String htmlText)` Inserts the HTML specified as a string after the the end of the given element.
    `void` | HTMLDocument.`insertAfterStart(Element elem, String htmlText)` Inserts the HTML specified as a string at the start of the element.
    `protected void` | HTMLEditorKit.InsertHTMLTextAction.`insertAtBoundary(JEditorPane editor, HTMLDocument doc, int offset, Element insertElement, String html, HTML.Tag parentTag, HTML.Tag addTag)` This is invoked when inserting at a boundary.
    `protected void` | HTMLEditorKit.InsertHTMLTextAction.`insertAtBoundry(JEditorPane editor, HTMLDocument doc, int offset, Element insertElement, String html, HTML.Tag parentTag, HTML.Tag addTag)` Deprecated. As of Java 2 platform v1.3, use insertAtBoundary
    `void` | HTMLDocument.`insertBeforeEnd(Element elem, String htmlText)` Inserts the HTML specified as a string at the end of the element.
    `void` | HTMLDocument.`insertBeforeStart(Element elem, String htmlText)` Inserts the HTML specified as a string before the start of the given element.
    `protected boolean` | MinimalHTMLWriter.`isText(Element elem)` Returns true if the element is a text element.
    `void` | HTMLDocument.`setInnerHTML(Element elem, String htmlText)` Replaces the children of the given element with the contents specified as an HTML string.
    `void` | HTMLDocument.`setOuterHTML(Element elem, String htmlText)` Replaces the given element in the parent with the contents specified as an HTML string.
    `protected void` | HTMLWriter.`startTag(Element elem)` Writes out a start tag for the element.
    `protected boolean` | HTMLWriter.`synthesizedElement(Element elem)` Returns true if the element is a synthesized element.
    `protected void` | MinimalHTMLWriter.`text(Element elem)` Writes out text.
    `protected void` | HTMLWriter.`text(Element elem)` Writes out text.
    `protected void` | MinimalHTMLWriter.`writeComponent(Element elem)` Responsible for handling Component Elements; deliberately unimplemented.
    `protected void` | MinimalHTMLWriter.`writeContent(Element elem, boolean needsIndenting)` Writes out the attribute set in an HTML-compliant manner.
    `protected void` | MinimalHTMLWriter.`writeImage(Element elem)` Responsible for handling Icon Elements; deliberately unimplemented.
    `protected void` | MinimalHTMLWriter.`writeLeaf(Element elem)` Responsible for writing out other non-text leaf elements.
    `protected void` | MinimalHTMLWriter.`writeStartParagraph(Element elem)` Emits the start tag for a paragraph.

    Constructors in javax.swing.text.html with parameters of type Element
    Constructor | Description
    --- | ---
    `BlockElement(Element parent, AttributeSet a)` Constructs a composite element that initially contains no children.
    `BlockView(Element elem, int axis)` Creates a new view that represents an html box.
    `FormView(Element elem)` Creates a new FormView object.
    `HTMLFrameHyperlinkEvent(Object source, HyperlinkEvent.EventType type, URL targetURL, Element sourceElement, String targetFrame)` Creates a new object representing a hypertext link event.
    `HTMLFrameHyperlinkEvent(Object source, HyperlinkEvent.EventType type, URL targetURL, String desc, Element sourceElement, InputEvent inputEvent, String targetFrame)` Creates a new object representing a hypertext link event.
    `HTMLFrameHyperlinkEvent(Object source, HyperlinkEvent.EventType type, URL targetURL, String desc, Element sourceElement, String targetFrame)` Creates a new object representing a hypertext link event.
    `ImageView(Element elem)` Creates a new view that represents an IMG element.
    `InlineView(Element elem)` Constructs a new view wrapped on an element.
    `ListView(Element elem)` Creates a new view that represents a list element.
    `ObjectView(Element elem)` Creates a new ObjectView object.
    `ParagraphView(Element elem)` Constructs a ParagraphView for the given element.
    `RunElement(Element parent, AttributeSet a, int offs0, int offs1)` Constructs an element that represents content within the document (has no children).

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.