how to detect tab key pressed by CefKeyboardHandler

Having problems with building or using the JCEF Java binding? Ask your questions here.

how to detect tab key pressed by CefKeyboardHandler

Postby micrikit » Wed Nov 23, 2022 8:54 pm

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
micrikit
Techie
 
Posts: 14
Joined: Tue Jun 14, 2022 2:10 am

Re: how to detect tab key pressed by CefKeyboardHandler

Postby FriwiDev » Mon Nov 28, 2022 4:29 pm

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.
Maintainer of jcefmaven on GitHub.
FriwiDev
Techie
 
Posts: 41
Joined: Sun Jul 09, 2017 4:18 am


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 20 guests