Could somebody throw some light on this particular code. It's throwing up some strange errors, ie: class or interface expected, that kind of thing. so it's probably just a mattter of having the parts in the right areas
Code:
jTextArea1 jtxt = new jTextArea1();
final UndoManager undo = new UndoManager();
Document doc = textarea.getDocument();
doc.addUndoableEditListener(new UndoableEditListener() {
public void undoableEditHappened(UndoableEditEvent evt) {
undo.addEdit(evt.getEdit());
}
});
// Create an undo action and add it to the text component
textcomp.getActionMap().put("Undo",
new AbstractAction("Undo") {
public void jButton18_actionPerformed(ActionEvent evt) {
try {
if (undo.canUndo()) {
undo.undo();
}
} catch (CannotUndoException e) {
}
}
});
// Create a redo action and add it to the text component
textarea.getActionMap().put("Redo",
new AbstractAction("Redo") {
public void jButton19_actionPerformed(ActionEvent evt) {
try {
if (undo.canRedo()) {
undo.redo();
}
} catch (CannotRedoException e) {
}
}
});*/