MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / keyPressed

Method keyPressed

CodenameOne/src/com/codename1/ui/Form.java:3159–3188  ·  view source on GitHub ↗
(int keyCode)

Source from the content-addressed store, hash-verified

3157
3158 /// {@inheritDoc}
3159 @Override
3160 public void keyPressed(int keyCode) {
3161 int game = Display.getInstance().getGameAction(keyCode);
3162 if (menuBar.handlesKeycode(keyCode)) {
3163 menuBar.keyPressed(keyCode);
3164 return;
3165 }
3166
3167 //Component focused = focusManager.getFocused();
3168 if (focused != null) {
3169 if (focused.isEnabled()) {
3170 focused.keyPressed(keyCode);
3171 }
3172 if (focused.handlesInput()) {
3173 return;
3174 }
3175 if (focused.getComponentForm() == this) { //NOPMD CompareObjectsWithEquals
3176 //if the arrow keys have been pressed update the focus.
3177 updateFocus(game);
3178 } else {
3179 initFocused();
3180 }
3181 } else {
3182 initFocused();
3183 if (focused == null) {
3184 getContentPane().moveScrollTowards(game, null);
3185 }
3186 }
3187
3188 }
3189
3190 /// Returns the layout manager of the form's content pane.
3191 ///

Callers 3

keyRepeatedMethod · 0.95
handleEventMethod · 0.95

Calls 11

getInstanceMethod · 0.95
updateFocusMethod · 0.95
initFocusedMethod · 0.95
getContentPaneMethod · 0.95
handlesKeycodeMethod · 0.80
keyPressedMethod · 0.65
isEnabledMethod · 0.65
getGameActionMethod · 0.45
handlesInputMethod · 0.45
getComponentFormMethod · 0.45
moveScrollTowardsMethod · 0.45

Tested by 1