I have a method where he performs another method depending on the button clicked. Only he seems to be running the methods called twice, and I do not know why. Can anyone help me and explain to me why this is? Follows the source
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
@Override
public void eventDispatched(final AWTEvent event) {
final KeyEvent evt = (KeyEvent) event;
switch (evt.getKeyCode()) {
case KeyEvent.VK_F1: {
//F1
doSomething(); // this method is running twice
break;
}
case KeyEvent.VK_F2: {
//F2
doSomething();
break;
}
}, AWTEvent.KEY_EVENT_MASK);
Thanks