I am trying to implement undo functionality in JTextArea. Googled for tutorial and followed one of the tutorial and wrote the below code. The event is triggered
JTextArea
I'm not sure but maybe you can not addKeyListener for your gui. For example;
class Example implements KeyListener{ . . . this.addKeyListener(this); // if want to add key listener for main container . . . }
this is about how to use key listener.