user3045496
user3045496

Reputation: 129

Undo Feature in Java

I want to add a 'Undo' feature to my application which removes the last entered number into a field. This is what I got so far

      private void btnUndo(java.awt.event.ActionEvent evt) {                         
    // TODO add your handling code here:


    final UndoManager manager = new UndoManager();

    if (evt.getActionCommand().equals("Undo")) {

        try {
            manager.undo();
        } catch (CannotUndoException ex) {
            ex.printStackTrace();
        }

    }



}    

Any Ideas? (I have no idea if this is right or not)

Thanks

Upvotes: 1

Views: 186

Answers (1)

Related Questions