Interface DocumentEvent
- All Known Implementing Classes:
AbstractDocument.DefaultDocumentEvent
public interface DocumentEvent
- See Also:
Nested Class Summary
Modifier and Type | Interface | Description |
---|---|---|
static interface |
DocumentEvent.ElementChange |
Describes changes made to a specific element. |
static final class |
DocumentEvent.EventType |
Enumeration for document event types |
Method Summary
Modifier and Type | Method | Description |
---|---|---|
DocumentEvent.ElementChange |
getChange |
Gets the change information for the given element. |
Document |
getDocument() |
Gets the document that sourced the change event. |
int |
getLength() |
Returns the length of the change. |
int |
getOffset() |
Returns the offset within the document of the start of the change. |
DocumentEvent.EventType |
getType() |
Gets the type of event. |
Method Details
getOffset
int getOffset()
- Returns:
- the offset >= 0
getLength
int getLength()
- Returns:
- the length >= 0
getDocument
Document getDocument()
- Returns:
- the document
getType
DocumentEvent.EventType getType()
- Returns:
- the type
getChange
DocumentEvent.ElementChange getChange(Element elem)
This method is for observers to discover the structural changes that were made. This means that only elements that existed prior to the mutation (and still exist after the mutation) need to have ElementChange records. The changes made available need not be recursive.
For example, if the an element is removed from it's parent, this method should report that the parent changed and provide an ElementChange implementation that describes the change to the parent. If the child element removed had children, these elements do not need to be reported as removed.
If an child element is insert into a parent element, the parent element should report a change. If the child element also had elements inserted into it (grandchildren to the parent) these elements need not report change.
- Parameters:
-
elem
- the element - Returns:
- the change information, or null if the element was not modified
© 1993, 2021, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/event/DocumentEvent.html