JCef browser overlying other components

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

JCef browser overlying other components

Postby newbieUser » Thu Oct 31, 2024 8:05 am

Hi!

We tried to integrate JCef with in one of our application and bump into problem when JInternalFrame where browserUI Component overlays other JInternalFrames that are visible in same DesktopPane.

I tired to reproduce it with example from JCef repository with simillar effect
So I modified application to include 3 JInternalFrames
To one of them I added JCef browser to the other one I added Canvas and just painted background. The third frame does not contain any additional elements.

The visible result is simillar to what we see in our application. Selected Frame is painted over Canvas without any problem but JCef browser is still visible over some part of that frame.
overlapingInternalFrames.png
overlapingInternalFrames.png (26.71 KiB) Viewed 1808 times


The code related to adding components is pretty simple. No additional changes to how JCef browser is initalized.
Code: Select all
private MainFrame(String startURL, boolean useOSR, boolean isTransparent) {
        ....
        JDesktopPane desktopPane = new JDesktopPane();
        prepareInternalFrameWithBrowser(desktopPane);
        prepareAnotherInternalFrame(desktopPane);
        prepareInternalFrameWithCanvas(desktopPane);
        // (5) All UI components are assigned to the default content pane of this
        //     JFrame and afterwards the frame is made visible to the user.
        getContentPane().add(desktopPane, BorderLayout.CENTER);
        setSize(800, 600);
        setVisible(true);
       addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                CefApp.getInstance().dispose();
                dispose();
            }
        });
    }

    private void prepareInternalFrameWithCanvas(JDesktopPane desktopPane) {
        JInternalFrame internalFrame = new JInternalFrame("Internal Frame with Canvas", true, true, true, true);
        Canvas canvas = new Canvas();
        canvas.setBackground(java.awt.Color.red);
        internalFrame.add(canvas);
        internalFrame.setVisible(true);
        internalFrame.setSize(300, 300);
        internalFrame.setLocation(200, 200);
        desktopPane.add(internalFrame);
    }

    private void prepareAnotherInternalFrame(JDesktopPane desktopPane) {
        JInternalFrame internalFrame = new JInternalFrame("Another Internal Frame", true, true, true, true);
        internalFrame.setVisible(true);
        internalFrame.setSize(300, 300);
        internalFrame.setLocation(400, 50);
        desktopPane.add(internalFrame);
    }

    private void prepareInternalFrameWithBrowser(JDesktopPane desktopPane) {
        JInternalFrame internalFrame = new JInternalFrame("Internal Frame", true, true, true, true);
        internalFrame.setVisible(true);
        internalFrame.getContentPane().add(browserUI_);
        internalFrame.setSize(300, 300);
        internalFrame.setLocation(50, 50);
        desktopPane.add(internalFrame);
    }
   ...


So it looks like there is some issue with how canvas from JCef browser component is rendered and refreshed.
But maybe I am missing something
newbieUser
Newbie
 
Posts: 1
Joined: Thu Oct 31, 2024 6:04 am

Re: JCef browser overlying other components

Postby magreenblatt » Thu Oct 31, 2024 9:52 am

magreenblatt
Site Admin
 
Posts: 12809
Joined: Fri May 29, 2009 6:57 pm


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 7 guests