1 56 57 package org.objectstyle.cayenne.dataview.dvmodeler; 58 59 import javax.swing.event.DocumentEvent ; 60 import javax.swing.event.DocumentListener ; 61 import javax.swing.text.*; 62 63 68 69 public class BasicDocumentListener implements DocumentListener { 70 71 public BasicDocumentListener() { 72 } 73 public void insertUpdate(DocumentEvent e) { 74 documentUpdated(getText(e.getDocument())); 75 } 76 public void removeUpdate(DocumentEvent e) { 77 documentUpdated(getText(e.getDocument())); 78 } 79 public void changedUpdate(DocumentEvent e) { 80 documentUpdated(getText(e.getDocument())); 81 } 82 83 private String getText(Document document) { 84 try { 85 return document.getText(0, document.getLength()); 86 } 87 catch (BadLocationException ex) { 88 return null; 89 } 90 } 91 92 public void documentUpdated(String text) { 93 } 94 } | Popular Tags |