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);