UI not showing in JLayeredPane

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

UI not showing in JLayeredPane

Postby Exilles » Sun Oct 23, 2022 5:16 am

Please tell me how to add browser to JLayeredPane.
I need to display transparent browser in front of media player (JVLC) (is it possible with JCEF?)
The jcefmaven example works for me, but I'm not sure if transparency works.
To test this, I added a JCEF UI to the JLayeredPane in front of the two buttons. After launching the application, I can see the buttons, but the browser did not display the page even though its status is 'INITIALIZED'.
Also I don't understand how JCEF works in other components. When I tried to add it to the JPanel, it also behaved, it was not visible, but loaded without errors.
The browser is visible only in the jcefmaven example, if it is run without changes.

Please prompt.
I am newbie trying to migrate from javafx to swing...

Also if you turn on OSR mode and transparency, then the background becomes a red-blue gradient, is this normal?

The main code is the same as in the jcefmaven example, but instead of getContentPane(), I use getLayeredPane():
Code: Select all
browser_ = client_.createBrowser(startURL, useOSR, isTransparent);
        browerUI_ = browser_.getUIComponent();
        browerUI_.setBackground(new Color(0,0,0,0));

        setLayout(new BorderLayout());
        getContentPane().add(browerUI_, BorderLayout.CENTER);
        Button red = new Button("RED");
        red.setSize(50, 50);
        red.setBackground(Color.RED);

        Button blue = new Button("BLUE");
        blue.setSize(150, 150);
        blue.setBackground(Color.BLUE);
        getLayeredPane().add(red, 2);
        getLayeredPane().add(blue, 1);
        getLayeredPane().add(browerUI_, 3);
        //pack();
        setSize(800, 600);
        setVisible(true);


I create a JFrame with the following parameters:
Code: Select all
boolean useOsr = false;
new MainFrame("https://google.com", useOsr, true, args);
Exilles
Newbie
 
Posts: 1
Joined: Sun Oct 23, 2022 4:59 am

Re: UI not showing in JLayeredPane

Postby SteveDevore » Wed Apr 12, 2023 7:55 am

Did you ever figure this out? I think I'm running into the same issue. See: https://magpcss.org/ceforum/viewtopic.php?f=17&t=19427
SteveDevore
Newbie
 
Posts: 2
Joined: Fri Apr 07, 2023 3:07 pm


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 143 guests

cron