1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| class MyDocumentListener implements DocumentListener {
String newline = "\n";
public void insertUpdate(DocumentEvent e) {
updateLog(e, "inserted into");
}
public void removeUpdate(DocumentEvent e) {
updateLog(e, "removed from");
}
public void changedUpdate(DocumentEvent e) {
}
public void updateLog(DocumentEvent e, String action) {
Document doc = (Document)e.getDocument();
int changeLength = e.getLength();
String toto = jTextArea2.getText();
if ((toto=="")||(toto==null))
{
BtnLgct.setEnabled(false);
}
else BtnLgct.setEnabled(true) ;
System.out.print(action + "\n" + toto + "\n");
}
} |