Search in sources :

Example 6 with Browser

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

the class ResourceViewer method createOfficeViewer.

/**
 * 创建文档文件查看器
 */
private void createOfficeViewer() {
    String officeName = resource.getPath();
    String pdfName = officeName.substring(0, officeName.lastIndexOf(".")) + ".pdf";
    String pdfPath = SpringUtil.getBean(HTTPUtils.class).getFullPath(ResourceConsts.FTP_CONVERT_PATH + pdfName);
    if (pdfPath == null) {
        return;
    }
    Browser browser = new Browser(BrowserType.LIGHTWEIGHT);
    browser.loadURL(pdfPath);
    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