APIdia Launch Partner
Top Description Methods
javax.swing.event

public Interface DocumentListener

extends EventListener
Known Direct Implementers
javax.swing.plaf.basic.BasicTextUI.UpdateHandler, javax.swing.text.DefaultCaret.Handler, javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.InputMethodRequestsHandler, javax.swing.text.html.AccessibleHTML.DocumentHandler, javax.swing.text.html.HiddenTagView, sun.awt.X11.XTextAreaPeer.AWTTextArea, sun.awt.X11.XTextFieldPeer.XAWTTextField, javax.swing.JFormattedTextField.DocumentHandler
Imports
java.util.EventListener

Interface for an observer to register to receive notifications of changes to a text document.

The default implementation of the Document interface (AbstractDocument) supports asynchronous mutations. If this feature is used (i.e. mutations are made from a thread other than the Swing event thread), the listeners will be notified via the mutating thread. This means that if asynchronous updates are made, the implementation of this interface must be threadsafe!

The DocumentEvent notification is based upon the JavaBeans event model. There is no guarantee about the order of delivery to listeners, and all listeners must be notified prior to making further mutations to the Document. This means implementations of the DocumentListener may not mutate the source of the event (i.e. the associated Document).

Author
Timothy Prinzing
See Also
javax.swing.text.Document, javax.swing.text.StyledDocument, DocumentEvent

Method Summary

Modifier and TypeMethod and Description
public void
changedUpdate(DocumentEvent
the document event
e
)

Gives notification that an attribute or set of attributes changed.

public void
insertUpdate(DocumentEvent
the document event
e
)

Gives notification that there was an insert into the document.

public void
removeUpdate(DocumentEvent
the document event
e
)

Gives notification that a portion of the document has been removed.

Method Detail

changedUpdateback to summary
public void changedUpdate(DocumentEvent e)

Gives notification that an attribute or set of attributes changed.

Parameters
e:DocumentEvent

the document event

insertUpdateback to summary
public void insertUpdate(DocumentEvent e)

Gives notification that there was an insert into the document. The range given by the DocumentEvent bounds the freshly inserted region.

Parameters
e:DocumentEvent

the document event

removeUpdateback to summary
public void removeUpdate(DocumentEvent e)

Gives notification that a portion of the document has been removed. The range is given in terms of what the view last saw (that is, before updating sticky positions).

Parameters
e:DocumentEvent

the document event