//The next two lines should be in one line.
doc.addUndoableEditListener(
The next two lines should be in one line.
public void undoableEditHappened(
undo.addEdit(evt.getEdit());
}
});
textarea.getActionMap().put("Undo",
try {
if (undo.canUndo()) {
undo.undo();
}
}
}
});
textarea.
getInputMap().
put(KeyStroke.
getKeyStroke( "control Z"), "Undo");
textarea.getActionMap().put("Redo",
try {
if (undo.canRedo()) {
undo.redo();
}
}
}
});
textarea.
getInputMap().
put(KeyStroke.
getKeyStroke( "control Y"), "Redo");