public class TextEvent extends Object
This event is sent to implementers of
ITextListener. It represents a change applied to text viewer. The change is specified as a replace command using offset, length, inserted text, and replaced text. The text viewer issues a text event after the viewer has been changed either in response to a change of the viewer's document or when the viewer's visual content has been changed. In the first case, the text event also carries the original document event. Depending on the viewer's presentation mode, the text event coordinates are different from the document event's coordinates.
An empty text event usually indicates a change of the viewer's redraw state.
Clients other than text viewer's don't create instances of this class.
Method SummaryModifier and TypeMethodDescriptionReturns the corresponding document event that caused the viewer change
intReturns the length of the event.
intReturns the offset of the event.Returns the text replaced by this event.
getText()Returns the text of the event.
booleanReturns the viewer's redraw state.
(int offset, int length, String text, String replacedText, DocumentEvent event, boolean viewerRedrawState)Creates a new
TextEventbased on the specification.
offset- the offset
length- the length
text- the inserted text
replacedText- the replaced text
event- the associated document event or
viewerRedrawState- the redraw state of the viewer
getOffsetpublic int getOffset()Returns the offset of the event.
- the offset of the event
getLengthpublic int getLength()Returns the length of the event.
- the length of the event
getTextpublic String getText()Returns the text of the event.
- the text of the event
getReplacedTextpublic String getReplacedText()Returns the text replaced by this event.
- the text replaced by this event
getDocumentEventpublic DocumentEvent getDocumentEvent()Returns the corresponding document event that caused the viewer change
- the corresponding document event,
nullif a visual change only
getViewerRedrawStatepublic boolean getViewerRedrawState()Returns the viewer's redraw state.
trueif the viewer's redraw state is