jxbrowser java代码直接调用js代码 (破解版请联系作者)免license

final Browser browser = new Browser();
        BrowserView browserView = new BrowserView(browser);
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.add(browserView, BorderLayout.CENTER);
        frame.setSize(700, 500);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
        browser.addLoadListener(new LoadAdapter() {
            @Override
            public void onFinishLoadingFrame(FinishLoadingEvent event) {
                if (event.isMainFrame()) {
                    browser.executeJavaScript("alert('java調用了js')");
                }
            }
        });
        browser.loadURL("E:/workspace48/browser/test.html");

作者QQ 921888199



jxbrowser java代码直接调用js代码 (破解版请联系作者)免license_第1张图片

你可能感兴趣的:(jxbrowser)