I have an application that needs to listen for the TAB key. As I've found out, TAB does not go through to the usual KeyListener, but is trapped by the KeyBoardFocusManager. So to catch it I have the following test code:

In the constructor for the class:

Java Code:
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this);

In the class:

Java Code:
public boolean dispatchKeyEvent(KeyEvent e) {
		if (e.getKeyCode() == KeyEvent.VK_TAB) {
			System.out.println("TAB"); 
                        return(true);
		}
		else return(false);
}
This works except the problem is every time TAB is pressed I'm catching it twice- presumably once for the key press and once for the key release. Only I can't find a way to distinguish the two. I need to do that so that I only process it once per key press. Any ideas?