by 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