Change existing browser parent container

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

Change existing browser parent container

Postby julia » Tue Sep 27, 2016 2:20 pm

Hello,

I'm writing an app for Windows
Using
JCEF Version = 3.2704.139
CEF Version = 3.2704.1427

I need to change parent of existing browser component, but when I do so, it seems that browser component is completely detached.
Parent JPanel becomes blank.

The code:
First I add CefBrowser to JPanel

Code: Select all
webPanel.add(browser_.getUIComponent(), BorderLayout.CENTER);

Everything is fine and page is loaded.

Then by button click I want to add browser to another JFrame.
Code: Select all
  JFrame frame = new JFrame();
  frame.setSize(1000, 800);
  frame.setUndecorated(true);
  frame.setVisible(true);
  frame.toFront();
  JPanel panel = new JPanel(new BorderLayout());
  frame.add(panel);
  panel.add(browser_.getUIComponent(), BorderLayout.CENTER);


After that I have two blank windows.

Is it possible to change CefBrowser parent container?

Thanks,
Julia
julia
Newbie
 
Posts: 3
Joined: Thu Sep 15, 2016 7:03 am

Re: Change existing browser parent container

Postby julia » Fri Oct 07, 2016 2:26 am

Hi All,

I've found a workaround in my project, so I don't need to change browser's parent container,
but still would be nice to know, if it's even possible..

Hope to hear any suggestions.
julia
Newbie
 
Posts: 3
Joined: Thu Sep 15, 2016 7:03 am

Re: Change existing browser parent container

Postby JanPesta » Tue Jan 30, 2018 9:45 am

Hi Julia,

Can you please share your workaround.

Thanks,
Jan
JanPesta
Newbie
 
Posts: 1
Joined: Tue Jan 30, 2018 9:43 am


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 18 guests