JBCefClient (@NotNull CefFocusHandler handler, @NotNull CefBrowser browser) { return myFocusHandler.add(handler, browser, () -> { myCefClient.addFocusHandler(new CefFocusHandler() { @Override public void onTakeFocus(CefBrowser browser, boolean next) { myFocusHandler.handle(browser, handler -> { handler.onTakeFocus(browser, next); }); } @Override public boolean onSetFocus(CefBrowser browser, FocusSource source) { return myFocusHandler.handleBoolean(browser, handler -> { return handler.onSetFocus(browser, source); }); } @Override public void onGotFocus(CefBrowser browser) { myFocusHandler.handle(browser, handler -> { handler.onGotFocus(browser); }); } }); }); }