JBCefClient (@NotNull CefKeyboardHandler handler, @NotNull CefBrowser browser) { return myKeyboardHandler.add(handler, browser, () -> { myCefClient.addKeyboardHandler(new CefKeyboardHandler() { @Override public boolean onPreKeyEvent(CefBrowser browser, CefKeyEvent event, BoolRef is_keyboard_shortcut) { return myKeyboardHandler.handleBoolean(browser, handler -> { return handler.onPreKeyEvent(browser, event, is_keyboard_shortcut); }); } @Override public boolean onKeyEvent(CefBrowser browser, CefKeyEvent event) { return myKeyboardHandler.handleBoolean(browser, handler -> { return handler.onKeyEvent(browser, event); }); } }); }); }