Cef Browser is showing blank

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

Cef Browser is showing blank

Postby suchira » Tue Mar 08, 2022 9:05 am

I have a swing based app where I am trying to display cefbrowser in a panel. However while running my app the browser is not showing up in the panel. In the console I am seeing the following being printed

Using:
JCEF Version = 84.3.8.266
CEF Version = 84.3.8
Chromium Version = 84.0.4147.105
initialize on Thread[AWT-EventQueue-0,6,main] with library path D:\org.jcef\libs
suchira
Newbie
 
Posts: 3
Joined: Thu Sep 17, 2020 8:36 am

Re: Cef Browser is showing blank

Postby FriwiDev » Sat Mar 12, 2022 5:59 am

Is there a reason for you to try with such an old chromium version? Have you considered using jcefmaven to bootstrap your jcef environment?
Apart from those two questions your post does not provide enough details to help you out. Can you add some more information? Like what your D:\org.jcef\libs folder looks like, what your code looks like...
Maintainer of jcefmaven on GitHub.
FriwiDev
Techie
 
Posts: 41
Joined: Sun Jul 09, 2017 4:18 am

Re: Cef Browser is showing blank

Postby suchira » Mon Mar 14, 2022 6:20 am

Hi Friwi,

There are certain restrictions in my organization due to which regular upgrades are not possible and hence I am using the mentioned chromium version.
I am not aware of jcefmaven.
The D:\org.jcef\libs contains all the related jcef dlls which are used for showing the jcef browser.
Please find below some of the code snippets
I have created a java class where inside the main method I am trying to get a jpanel containing the cefbrowser and I am embedding it inside contentPane of JFrame.
JPanel contentPane = new JPanel();
contentPane.setBorder( new EmptyBorder( 5, 5, 5, 5 ) );
contentPane.setLayout( new GridLayout( 1, 2 ) );
TestSwing frame = new TestSwing();
frame.setContentPane(contentPane);
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setResizable(true);
frame.setVisible(true);
JCEFBrowserPanel hostedAWPanel = hostingAPIs.getJCEFSwing();
if( hostedAWPanel != null ) {
contentPane.add(hostedAWPanel);
hostedAWPanel.setPanelReady();
contentPane.setVisible(true);
frame.setVisible(true);
}

In the above code this API getJCEFSwing returns us a JPanel with cef browser embedded. Please find below the code of how we are embedding the cef browser inside JPanel

final ControlPanel controlPanel = new ControlPanel( JCEFBrowserPanel.this, m_browser.getBrowser() );

n the above code m_browser is an instance of our internal API where we create the browser by the below code
if( m_browser == null )
{
m_browser = client_.createBrowser( "about:blank", false, false, null );
m_browser.createImmediately();
}
In the above code the client is CefClient.
In the API where we are creating the m_browser we are also implementing CefMessageRouterHandlerAdapter and CefMessageRouterConfig
suchira
Newbie
 
Posts: 3
Joined: Thu Sep 17, 2020 8:36 am

Re: Cef Browser is showing blank

Postby FriwiDev » Tue Mar 22, 2022 6:59 am

Hmm, I can not diagnose the error from the information that you have given. There are just too many variables.

As a general note, I would like to suggest migrating to jcefmaven in your organization. It will greatly reduce your effort to get jcef running inside your application on all platforms and if any errors arise in the future it will allow for one central fix - not all developers fixing the same bug individually.
Maintainer of jcefmaven on GitHub.
FriwiDev
Techie
 
Posts: 41
Joined: Sun Jul 09, 2017 4:18 am


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 22 guests