Source code: javax/ide/editor/EditorEvent.java
1 package javax.ide.editor;
2
3 import java.util.EventObject;
4
5 import javax.ide.editor.Editor;
6
7 /**
8 * The DocumentEvent is the parameter passed to the {@link EditorListener}
9 * methods when the state of {@link Editor} has changed. <p>
10 *
11 * The <code>EditorEvent</code> source is the editor instance whose state
12 * is changing. The convenience method {@link #getEditor} can be used to
13 * retrieve the editor instance.
14 */
15 public final class EditorEvent extends EventObject
16 {
17 /**
18 * Constructor.
19 *
20 * @param editor the editor where the event happened.
21 */
22 public EditorEvent( Editor editor )
23 {
24 super(editor);
25 }
26
27 /**
28 * Get the {@link Editor} where the event happened.
29 * This is functionally equivalent to casting the result of getSource() to
30 * a <code>Editor</code> object.
31 *
32 * @return the {@link Editor} whose state has changed.
33 */
34 public Editor getEditor()
35 {
36 return (Editor)getSource();
37 }
38 }