Skip to content

Instantly share code, notes, and snippets.

@keithrbennett
Created February 24, 2009 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keithrbennett/69732 to your computer and use it in GitHub Desktop.
Save keithrbennett/69732 to your computer and use it in GitHub Desktop.
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
/**
* Simplifies the DocumentListener interface by having all three
* interface methods delegate to a single method.
*
* To use this abstract class, subclass it and implement the abstract
* method handleDocumentEvent().
*/
public abstract class SimpleDocumentListener implements DocumentListener {
/**
* Implement this method when subclassing this class.
* It will be called whenever a DocumentEvent occurs.
*/
abstract public void handleDocumentEvent(DocumentEvent event);
public void changedUpdate(DocumentEvent event) {
handleDocumentEvent(event);
}
public void insertUpdate(DocumentEvent event) {
handleDocumentEvent(event);
}
public void removeUpdate(DocumentEvent event) {
handleDocumentEvent(event);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment