Page 1 of 1

Regarding blank screen when setUndecorated gets called

PostPosted: Fri Oct 30, 2020 2:23 am
by ashishguptamca
Dear Support,
Below is my code
final JFrame frame = new JFrame();
BrowserComponent browser2 = new BrowserComponent(urls[0], null, null);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
// CefApp.getInstance().dispose();
// System.exit(0);
frame.setSize(800, 600);

Where BrowserComponent is simple browser class

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

CefSettings settings = new CefSettings();
settings.windowless_rendering_enabled = false;
// try to load URL "about:blank" to see the background color
settings.background_color = ColorType(100, 255, 242, 211);
CefApp myApp = null;
try {
myApp = CefApp.getInstance(null, settings);
// CefApp.addAppHandler(new AppHandler(null));
CefApp.addAppHandler(new CefAppHandlerAdapter(null) {
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);
browser_ = client_.createBrowser(url, false, false);

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?