Page 1 of 1

how to detect tab key pressed by CefKeyboardHandler

PostPosted: Wed Nov 23, 2022 8:54 pm
by micrikit
hi
I coded program using JCEF with Swing.
I want to detect any key pressing and show it in console.
So made a custom class implements CefKeyboardHandler and override onKeyEvent like it below.
Code: Select all
public class KeyboardHandler implements CefKeyboardHandler {
   @Override
   public boolean onKeyEvent(CefBrowser browser, CefKeyEvent event) {
      System.out.println("key pressed : " + event.character);
   }
}

It can show key character in console EXCEPT tab key.
I assume web page don't throw tab key pressed event to JCEF properly.
How can I solve this?

Thank you

Re: how to detect tab key pressed by CefKeyboardHandler

PostPosted: Mon Nov 28, 2022 4:29 pm
by FriwiDev
The key event also provides a key type and not only a character. You can implement an additional logic for tabs. Also you should be able to capture all key presses from the swing component as well.