/** * Processes a key press. * * <p>if the key pressed is the right or left key focus is changed appropriately. All other keys * are passed to the component which currently has focus. * * @param keyCode Code of the key pressed. */ public void keyPressed(int keyCode) { if (Debug.ON) Logger.dev("OFocusManager.keyPressed CALLED w/keyCode=" + keyCode); // // NOTE: Not all screens will have a focusedComponent // therefore we shall check for null and ensure // it can handle the keypress. Otherwise, we // shall get the traverse directions // if (focusedComponent == null) return; int directions = focusedComponent.getTraverseDirections(); if (keyCode == OAbstractScreen.RIGHT_KEY && (OFocusableComponent.RIGHT & directions) > 0) { moveToNextField(); } else if (keyCode == OAbstractScreen.LEFT_KEY && (OFocusableComponent.LEFT & directions) > 0) { moveToPreviousField(); } else if (keyCode == OAbstractScreen.DOWN_KEY && (OFocusableComponent.DOWN & directions) > 0) { moveToNextField(); } else if (keyCode == OAbstractScreen.UP_KEY && (OFocusableComponent.UP & directions) > 0) { moveToPreviousField(); } else // pass the key stroke to the component with focus { focusedComponent.keyPressed(keyCode); } if (Debug.ON) Logger.dev("OFocusManager.keyPressed EXITTING"); } // keyPressed