KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > event > DocumentListener


1 /*
2  * @(#)DocumentListener.java 1.14 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package javax.swing.event;
8
9 import java.util.EventListener JavaDoc;
10
11 /**
12  * Interface for an observer to register to receive notifications
13  * of changes to a text document.
14  * <p>
15  * The default implementation of
16  * the Document interface (AbstractDocument) supports asynchronous
17  * mutations. If this feature is used (i.e. mutations are made
18  * from a thread other than the Swing event thread), the listeners
19  * will be notified via the mutating thread. <em>This means that
20  * if asynchronous updates are made, the implementation of this
21  * interface must be threadsafe</em>!
22  * <p>
23  * The DocumentEvent notification is based upon the JavaBeans
24  * event model. There is no guarantee about the order of delivery
25  * to listeners, and all listeners must be notified prior to making
26  * further mutations to the Document. <em>This means implementations
27  * of the DocumentListener may not mutate the source of the event
28  * (i.e. the associated Document)</em>.
29  *
30  * @author Timothy Prinzing
31  * @version 1.14 12/19/03
32  * @see javax.swing.text.Document
33  * @see javax.swing.text.StyledDocument
34  * @see DocumentEvent
35  */

36 public interface DocumentListener extends EventListener JavaDoc {
37
38     /**
39      * Gives notification that there was an insert into the document. The
40      * range given by the DocumentEvent bounds the freshly inserted region.
41      *
42      * @param e the document event
43      */

44     public void insertUpdate(DocumentEvent JavaDoc e);
45
46     /**
47      * Gives notification that a portion of the document has been
48      * removed. The range is given in terms of what the view last
49      * saw (that is, before updating sticky positions).
50      *
51      * @param e the document event
52      */

53     public void removeUpdate(DocumentEvent JavaDoc e);
54
55     /**
56      * Gives notification that an attribute or set of attributes changed.
57      *
58      * @param e the document event
59      */

60     public void changedUpdate(DocumentEvent JavaDoc e);
61 }
62
Popular Tags