pottermm / javachromiumembedded

Automatically exported from code.google.com/p/javachromiumembedded
0 stars 0 forks source link

Tabbed Browser view #131

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Creating tabbed browsers

What is the expected output? What do you see instead?
Creating tabbed browsers requires CEFSettings to be set before the createClient 
is called.

What version of the product are you using? On what operating system?
JCEF Version = 3.1916.1857.110
CEF Version = 3.1916.1857
Chromium Version = 35.0.1916.138

OS: Windows 7 (x64)

Please provide any additional information below.
Before these CEFSettings, I have created tabbed browsers by making small 
changes to the MainFrame call returned a JPanel with the browser object and 
added them to the JTabbedPane, but we're getting the following exception: 
"Settings can only be passed to CEF before createClient is called the first 
time" when I tried the same with the CEFSettings are still passed before 
createClient.

Can anyone suggest what will be the perfect way to create browsers inside 
TabbedPane?

Original issue reported on code.google.com by arun.vc....@gmail.com on 29 Oct 2014 at 2:24

GoogleCodeExporter commented 9 years ago
Hi arun.vc...,

your posted issue is more a "How To use..." question and not a classical issue. 
If you have any questions like yours, please ask them on the CEF-Forum 
(http://www.magpcss.org/ceforum/index.php).

Anyway a short answer here:
What kind of "small changes"? As the exception says, CefSettings can only be 
passed to CefApp if it is in state "NONE" or "NEW". Otherwise it doesn't make 
sense because the settings are only handled on initial startup.

Call CefApp.getInstance(CefSettings settings) or CefApp.getInstance(String[] 
args, CefSettings settings) only once at startup. After that just call 
CefApp.getInstance() in your code if you need an instance of CefApp.

You can use for example the following code-snippet in your App-Initialization:

CefSettings mySettings = new CefSettings();
mySettings....; // make your settings here

CefApp myApp = CefApp.getInstance();
myApp. setSettings(mySettings);

or somewhat shorter::

CefApp.getInstance(mySettings);

After that you should just call getInstance() without any parameters in the 
rest of your code:

CefClient myClient = CefApp.getInstance().createClient(...);

Another way would be to use a try-catch clause if you want to use the same 
initial code snippet several times:

CefApp app = null;
CefSettings mySettings = ...;
try {
  app = CefApp.getInstance(mySettings);
} catch (IllegalStateException e) {
  app = CefApp.getInstance();
}
app.createClient().createBrowser(...);

Hope this helps, or did I miss your point?

Regards,
Kai

Original comment by k...@censhare.de on 30 Oct 2014 at 6:16

GoogleCodeExporter commented 9 years ago
Thanks Kai for clarifying. I'll try out like you suggested and post the "How to 
use.." question in the CEF-Forum (http://www.magpcss.org/ceforum/index.php) 
henceforth.

Original comment by arun.vc....@gmail.com on 30 Oct 2014 at 6:22

GoogleCodeExporter commented 9 years ago

Original comment by magreenb...@gmail.com on 30 Oct 2014 at 5:54