-
- All Superinterfaces:
- EventListener
- All Known Implementing Classes:
- JEditorPane.AccessibleJEditorPane, JEditorPane.AccessibleJEditorPaneHTML, JEditorPane.JEditorPaneAccessibleHypertextSupport, JPasswordField.AccessibleJPasswordField, JTextArea.AccessibleJTextArea, JTextComponent.AccessibleJTextComponent, JTextField.AccessibleJTextField
public interface DocumentListener extends 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).
- See Also:
Document
,StyledDocument
,DocumentEvent
-
-
Method Summary
Methods Modifier and Type Method and Description void
changedUpdate(DocumentEvent e)
Gives notification that an attribute or set of attributes changed.void
insertUpdate(DocumentEvent e)
Gives notification that there was an insert into the document.void
removeUpdate(DocumentEvent e)
Gives notification that a portion of the document has been removed.
-
-
-
Method Detail
-
insertUpdate
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
- the document event
-
removeUpdate
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
- the document event
-
changedUpdate
void changedUpdate(DocumentEvent e)
Gives notification that an attribute or set of attributes changed.- Parameters:
e
- the document event
-
-
Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/swing/event/DocumentListener.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.