public class AbstractDocument.DefaultDocumentEvent extends CompoundEdit implements DocumentEvent
DocumentEvent.ElementChange, DocumentEvent.EventTypeeditsRedoName, UndoName| Constructor and Description |
|---|
DefaultDocumentEvent(int offs,
int len,
DocumentEvent.EventType type)
Constructs a change record.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addEdit(UndoableEdit anEdit)
Adds a document edit.
|
DocumentEvent.ElementChange |
getChange(Element elem)
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.
|
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.
|
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, lastEditreplaceEditpublic 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 CompoundEditpublic boolean addEdit(UndoableEdit anEdit)
addEdit in interface UndoableEditaddEdit in class CompoundEditanEdit - a document edit recordUndoableEdit.addEdit(javax.swing.undo.UndoableEdit)public void redo()
throws CannotRedoException
redo in interface UndoableEditredo in class CompoundEditCannotRedoException - if the change cannot be redoneAbstractUndoableEdit.canRedo()public void undo()
throws CannotUndoException
undo in interface UndoableEditundo in class CompoundEditCannotUndoException - if the change cannot be undoneAbstractUndoableEdit.canUndo()public boolean isSignificant()
isSignificant in interface UndoableEditisSignificant in class CompoundEditUndoableEdit.isSignificant()public String getPresentationName()
getPresentationName in interface UndoableEditgetPresentationName in class CompoundEditAbstractUndoableEdit.getUndoPresentationName(),
AbstractUndoableEdit.getRedoPresentationName()public String getUndoPresentationName()
getUndoPresentationName in interface UndoableEditgetUndoPresentationName in class CompoundEditAbstractUndoableEdit.getPresentationName()public String getRedoPresentationName()
getRedoPresentationName in interface UndoableEditgetRedoPresentationName in class CompoundEditAbstractUndoableEdit.getPresentationName()public DocumentEvent.EventType getType()
getType in interface DocumentEventDocumentEvent.getType()public int getOffset()
getOffset in interface DocumentEventDocumentEvent.getOffset()public int getLength()
getLength in interface DocumentEventDocumentEvent.getLength()public Document getDocument()
getDocument in interface DocumentEventDocumentEvent.getDocument()public DocumentEvent.ElementChange getChange(Element elem)
getChange in interface DocumentEventelem - the element 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, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.