Methods Summary |
---|
public void | changedUpdate(javax.swing.event.DocumentEvent ev)
showDocEvent(ev);
|
public void | insertUpdate(javax.swing.event.DocumentEvent ev)
showDocEvent(ev);
|
public static void | main(java.lang.String[] args)
JFrame f = new Listen();
f.addWindowListener(new BasicWindowMonitor());
f.setVisible(true);
|
public void | removeUpdate(javax.swing.event.DocumentEvent ev)
showDocEvent(ev);
|
protected void | showDocEvent(javax.swing.event.DocumentEvent ev)
StringBuffer buf = new StringBuffer(100);
buf.append(ev.getType());
buf.append(" offset:");
buf.append(ev.getOffset());
buf.append(" length:");
buf.append(ev.getLength());
// Show any ElementChanges that were provided
Element root = editor.getDocument().getDefaultRootElement();
DocumentEvent.ElementChange chg = ev.getChange(root);
if (chg == null) {
buf.append(" <NO ELEMENT CHANGES>");
}
else {
buf.append(" Changes (Index/Add/Rem):");
buf.append(chg.getIndex());
buf.append("/");
buf.append(chg.getChildrenAdded().length);
buf.append("/");
buf.append(chg.getChildrenRemoved().length);
}
buf.append("\n");
log.append(buf.toString());
|
public void | undoableEditHappened(javax.swing.event.UndoableEditEvent ev)
StringBuffer buf = new StringBuffer(100);
edit = ev.getEdit();
buf.append("UndoableEdit:");
buf.append(edit.getPresentationName());
buf.append("\n");
log.append(buf.toString());
updateMenu();
|
protected void | updateMenu()
if (edit != null) {
undoItem.setEnabled(edit.canUndo());
redoItem.setEnabled(edit.canRedo());
undoItem.setText(edit.getUndoPresentationName());
redoItem.setText(edit.getRedoPresentationName());
}
else {
undoItem.setEnabled(false);
redoItem.setEnabled(false);
undoItem.setText("Undo");
redoItem.setText("Redo");
}
|