- Code: Select all
final CefApp cefApp = CefApp.getInstance();
final CefClient client = cefApp.createClient();
final CefBrowser browser = client.createBrowser("http://www.google.com", OS.isWindows(), false);
final Component browserUI = browser.getUIComponent();
getContentPane().add(browserUI, BorderLayout.CENTER);
The same happens with a JPanel.
- Code: Select all
jPanel1.add(browserUI, BorderLayout.CENTER);
However, when I programatically initiate a new, separate JFrame window, it works perfectly.
- Code: Select all
final JFrame mainFrame = new JFrame();
getContentPane().add(browserUI, BorderLayout.CENTER);
mainFrame.setSize(800, 600);
mainFrame.setVisible(true);
Why is this happening? How can I get it to work in any other JFrame or JPanel?