Regarding blank screen when setUndecorated gets called

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

Regarding blank screen when setUndecorated gets called

Postby ashishguptamca » Fri Oct 30, 2020 2:23 am

Dear Support,
Below is my code
final JFrame frame = new JFrame();
BrowserComponent browser2 = new BrowserComponent(urls[0], null, null);
frame.getContentPane().add(browser2.getBrowser_().getUIComponent());
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
frame.dispose();
// CefApp.getInstance().dispose();
// System.exit(0);
}
});
//
frame.setSize(800, 600);
frame.setUndecorated(true);
frame.setVisible(true);

Where BrowserComponent is simple browser class

public BrowserComponent(String url, String userAgent, String sotreId) {
super();

CefSettings settings = new CefSettings();
settings.windowless_rendering_enabled = false;
// try to load URL "about:blank" to see the background color
settings.background_color = settings.new ColorType(100, 255, 242, 211);
CefApp myApp = null;
try {
myApp = CefApp.getInstance(null, settings);
// CefApp.addAppHandler(new AppHandler(null));
CefApp.addAppHandler(new CefAppHandlerAdapter(null) {
@Override
public void onBeforeCommandLineProcessing(String process_type, CefCommandLine command_line) {
super.onBeforeCommandLineProcessing(process_type, command_line);
if (process_type.isEmpty()) {
command_line.appendSwitchWithValue("enable-media-stream", "true");
}
}
});
} catch (IllegalStateException e) {
myApp = CefApp.getInstance();
}
client_ = myApp.createClient();
CefMessageRouter msgRouter = CefMessageRouter.create();
msgRouter.addHandler(new MessageRouterHandler(), true);
msgRouter.addHandler(new MessageRouterHandlerEx(client_), false);
client_.addMessageRouter(msgRouter);
browser_ = client_.createBrowser(url, false, false);
//browser_.createImmediately();
}

Now if I comment the above line frame.setUndecorated(true);, it shows me the url loaded in the frame. However, if I uncomment the above line, the frame.setUndecorated(true) shows me blank gray window without any url loaded content in it.

What can be the reason?
Thanks,
Ashish
ashishguptamca
Newbie
 
Posts: 2
Joined: Fri Oct 30, 2020 1:55 am

Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 3 guests