Search in sources :

Example 1 with Browser

use of com.teamdev.jxbrowser.chromium.Browser in project TeachingInSimulation by ScOrPiOzzy.

the class TestJxBrowserJfx method start.

@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.initStyle(StageStyle.DECORATED);
    Browser browser = new Browser(BrowserType.LIGHTWEIGHT);
    BrowserView view = new BrowserView(browser);
    primaryStage.setScene(new Scene(view));
    browser.loadURL("http://file.keking.cn/");
    // browser.loadURL("http://58.214.15.134:8945/DigitalCampus_v3.0_nj/loginInit!init.action");
    // browser.setContextMenuHandler(new ContextMenuHandler() {
    // @Override
    // public void showContextMenu(ContextMenuParams params) {
    // System.out.println(params.getPageURL());
    // }
    // });
    primaryStage.show();
}
Also used : BrowserView(com.teamdev.jxbrowser.chromium.javafx.BrowserView) Scene(javafx.scene.Scene) Browser(com.teamdev.jxbrowser.chromium.Browser)

Example 2 with Browser

use of com.teamdev.jxbrowser.chromium.Browser in project TeachingInSimulation by ScOrPiOzzy.

the class TestJxBrowserPdf method start.

@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.initStyle(StageStyle.TRANSPARENT);
    Browser browser = new Browser(BrowserType.LIGHTWEIGHT);
    BrowserView view = new BrowserView(browser);
    primaryStage.setScene(new Scene(view));
    browser.loadURL("http://192.168.1.19:8082/Test/Fanuc0i参数说明书.pdf");
    // browser.executeJavaScript("var child=document.getElementById(\\\"download\\\");child.parentNode.removeChild(child);");
    // browser.executeJavaScript("alert(document.getElementById('download'))");
    browser.setDownloadHandler(new DownloadHandler() {

        @Override
        public boolean allowDownload(DownloadItem download) {
            System.out.println(download.getURL());
            return false;
        }
    });
    primaryStage.show();
}
Also used : DownloadHandler(com.teamdev.jxbrowser.chromium.DownloadHandler) BrowserView(com.teamdev.jxbrowser.chromium.javafx.BrowserView) DownloadItem(com.teamdev.jxbrowser.chromium.DownloadItem) Scene(javafx.scene.Scene) Browser(com.teamdev.jxbrowser.chromium.Browser)

Example 3 with Browser

use of com.teamdev.jxbrowser.chromium.Browser in project TeachingInSimulation by ScOrPiOzzy.

the class TestJxBrowserSwf method start.

@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.initStyle(StageStyle.DECORATED);
    Browser browser = new Browser();
    BrowserView view = new BrowserView(browser);
    primaryStage.setScene(new Scene(view));
    browser.loadHTML(HTML_SWF_HEAD + "http://192.168.1.19:8082/Test/teachResources.swf" + HTML_SWF_END);
    primaryStage.show();
}
Also used : BrowserView(com.teamdev.jxbrowser.chromium.javafx.BrowserView) Scene(javafx.scene.Scene) Browser(com.teamdev.jxbrowser.chromium.Browser)

Example 4 with Browser

use of com.teamdev.jxbrowser.chromium.Browser in project Spark by igniterealtime.

the class SparkMeetPlugin method open.

private void open(String roomUrl, String roomId) {
    browser = new Browser();
    BrowserView view = new BrowserView(browser);
    frame = new JFrame();
    frame.add(view, BorderLayout.CENTER);
    frame.setSize(width, height);
    frame.setVisible(true);
    frame.setTitle("Openfire Meetings - " + roomId);
    frame.addWindowListener(new java.awt.event.WindowAdapter() {

        @Override
        public void windowClosing(java.awt.event.WindowEvent windowEvent) {
            close();
        }
    });
    browser.loadURL(roomUrl);
}
Also used : BrowserView(com.teamdev.jxbrowser.chromium.swing.BrowserView) Browser(com.teamdev.jxbrowser.chromium.Browser)

Example 5 with Browser

use of com.teamdev.jxbrowser.chromium.Browser in project TeachingInSimulation by ScOrPiOzzy.

the class ResourceViewer method createPDFViewer.

/**
 * 创建PDF查看器
 */
private void createPDFViewer() {
    HTTPUtils utils = SpringUtil.getBean(HTTPUtils.class);
    String url = utils.getFullPath(ResourceConsts.FTP_RES_PATH + resource.getPath());
    if (url == null) {
        return;
    }
    Browser browser = new Browser(BrowserType.LIGHTWEIGHT);
    browser.loadURL(url);
    BrowserView view = new BrowserView(browser);
    viewer.getChildren().add(view);
}
Also used : BrowserView(com.teamdev.jxbrowser.chromium.javafx.BrowserView) HTTPUtils(com.cas.sim.tis.util.HTTPUtils) Browser(com.teamdev.jxbrowser.chromium.Browser)

Aggregations

Browser (com.teamdev.jxbrowser.chromium.Browser)6 BrowserView (com.teamdev.jxbrowser.chromium.javafx.BrowserView)5 Scene (javafx.scene.Scene)3 HTTPUtils (com.cas.sim.tis.util.HTTPUtils)2 DownloadHandler (com.teamdev.jxbrowser.chromium.DownloadHandler)1 DownloadItem (com.teamdev.jxbrowser.chromium.DownloadItem)1 BrowserView (com.teamdev.jxbrowser.chromium.swing.BrowserView)1