Serializable, DocumentEvent, UndoableEdit
AbstractDocumentpublic class AbstractDocument.DefaultDocumentEvent extends CompoundEdit implements DocumentEvent
DocumentEvent.ElementChange, DocumentEvent.EventType
edits
RedoName, UndoName
| Constructor | Description | 
|---|---|
| DefaultDocumentEvent | Constructs a change record. | 
| Modifier and Type | Method | Description | 
|---|---|---|
| boolean | addEdit | Adds a document edit. | 
| DocumentEvent.ElementChange | getChange | Gets the changes for an 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. | 
| String | getPresentationName() | Provides a localized, human readable description of this edit suitable for use in, say, a change log. | 
| String | getRedoPresentationName() | Provides a localized, human readable description of the redoable form of this edit, e.g. for use as a Redo menu item. | 
| DocumentEvent.EventType | getType() | Returns the type of event. | 
| String | getUndoPresentationName() | Provides a localized, human readable description of the undoable form of this edit, e.g. for use as an Undo menu item. | 
| boolean | isSignificant() | DefaultDocument events are significant. | 
| void | redo() | Redoes a change. | 
| String | toString() | Returns a string description of the change event. | 
| void | undo() | Undoes a change. | 
canRedo, canUndo, die, end, isInProgress, lastEdit
replaceEdit
public DefaultDocumentEvent(int offs, int len, DocumentEvent.EventType type)
offs - the offset into the document of the change >= 0len - the length of the change >= 0type - the type of event (DocumentEvent.EventType)public String toString()
toString in class CompoundEdit
public boolean addEdit(UndoableEdit anEdit)
addEdit in interface UndoableEdit
addEdit in class CompoundEdit
anEdit - a document edit recordpublic void redo() throws CannotRedoException
redo in interface UndoableEdit
redo in class CompoundEdit
CannotRedoException - if the change cannot be redonepublic void undo() throws CannotUndoException
undo in interface UndoableEdit
undo in class CompoundEdit
CannotUndoException - if the change cannot be undonepublic boolean isSignificant()
isSignificant in interface UndoableEdit
isSignificant in class CompoundEdit
public String getPresentationName()
getPresentationName in interface UndoableEdit
getPresentationName in class CompoundEdit
public String getUndoPresentationName()
getUndoPresentationName in interface UndoableEdit
getUndoPresentationName in class CompoundEdit
public String getRedoPresentationName()
getRedoPresentationName in interface UndoableEdit
getRedoPresentationName in class CompoundEdit
public DocumentEvent.EventType getType()
getType in interface DocumentEvent
public int getOffset()
getOffset in interface DocumentEvent
public int getLength()
getLength in interface DocumentEvent
public Document getDocument()
getDocument in interface DocumentEvent
public DocumentEvent.ElementChange getChange(Element elem)
getChange in interface DocumentEvent
elem - the element
    © 1993, 2023, 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/21/docs/api/java.desktop/javax/swing/text/AbstractDocument.DefaultDocumentEvent.html