JPanel (boolean isMouseWheelEventEnabled) { Component uiComp = getCefBrowser().getUIComponent(); JPanel resultPanel = new MyPanel(uiComp, isMouseWheelEventEnabled); resultPanel.setBackground(getBackgroundColor()); resultPanel.putClientProperty(JBCEFBROWSER_INSTANCE_PROP, this); if (SystemInfo.isMac) { // We handle shortcuts manually on MacOS: https://www.magpcss.org/ceforum/viewtopic.php?f=6&t=12561 ShortcutProvider.registerShortcuts(resultPanel, this); } resultPanel.add(uiComp, BorderLayout.CENTER); if (SystemInfo.isWindows) { myCefBrowser.getUIComponent().addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (myCefBrowser.getUIComponent().isFocusable()) { getCefBrowser().setFocus(true); } } }); } resultPanel.setFocusCycleRoot(true); resultPanel.setFocusTraversalPolicyProvider(true); resultPanel.setFocusTraversalPolicy(new MyFTP()); resultPanel.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { ourOnBrowserMoveResizeCallbacks.forEach(callback -> callback.accept(JBCefBrowser.this)); } @Override public void componentMoved(ComponentEvent e) { ourOnBrowserMoveResizeCallbacks.forEach(callback -> callback.accept(JBCefBrowser.this)); } @Override public void componentShown(ComponentEvent e) { ourOnBrowserMoveResizeCallbacks.forEach(callback -> callback.accept(JBCefBrowser.this)); } @Override public void componentHidden(ComponentEvent e) { ourOnBrowserMoveResizeCallbacks.forEach(callback -> callback.accept(JBCefBrowser.this)); } }); return resultPanel; }