1. /*
  2. * @(#)DocumentListener.java 1.11 00/02/02
  3. *
  4. * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package javax.swing.event;
  11. import java.util.EventListener;
  12. /**
  13. * Interface for an observer to register to receive notifications
  14. * of changes to a text document.
  15. * <p>
  16. * The default implementation of
  17. * the Document interface (AbstractDocument) supports asynchronous
  18. * mutations. If this feature is used (i.e. mutations are made
  19. * from a thread other than the Swing event thread), the listeners
  20. * will be notified via the mutating thread. <em>This means that
  21. * if asynchronous updates are made, the implementation of this
  22. * interface must be threadsafe</em>!
  23. * <p>
  24. * The DocumentEvent notification is based upon the JavaBeans
  25. * event model. There is no guarantee about the order of delivery
  26. * to listeners, and all listeners must be notified prior to making
  27. * further mutations to the Document. <em>This means implementations
  28. * of the DocumentListener may not mutate the source of the event
  29. * (i.e. the associated Document)</em>.
  30. *
  31. * @author Timothy Prinzing
  32. * @version 1.11 02/02/00
  33. * @see javax.swing.text.Document
  34. * @see javax.swing.text.StyledDocument
  35. * @see DocumentEvent
  36. */
  37. public interface DocumentListener extends EventListener {
  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 e);
  45. /**
  46. * Gives notification that a portion of the document has been
  47. * removed. The range is given in terms of what the view last
  48. * saw (that is, before updating sticky positions).
  49. *
  50. * @param e the document event
  51. */
  52. public void removeUpdate(DocumentEvent e);
  53. /**
  54. * Gives notification that an attribute or set of attributes changed.
  55. *
  56. * @param e the document event
  57. */
  58. public void changedUpdate(DocumentEvent e);
  59. }