JavaFX 2.2 Web视图 [英] JavaFX 2.2 WebView

查看:74
本文介绍了JavaFX 2.2 Web视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Javafx和FXML.我已经创建了表格.在我的其中一个页面中,我的左窗格(拆分窗格")中有一棵树,而右痛苦是右锚定"窗格中的一个Webview.

I am using Javafx and FXML . I have created my form . in one of my pages I have a Tree in the left pane (Split Pane) , and the right pain is a Webview inside the right Anchor pane.

当我在树(treeItem)上选择一个节点时,Web视图将相应地更改为在树视图中选择的相应站点.

when I select a node on the tree (treeItem) the webview will change accordingly to the respective site that was selected in the tree view.

当我将其作为应用程序运行时,它可以工作(就像超级按钮一样).

This works (like a charm)when I run it as an application.

但是,当在浏览器中查看此文件(即chrome,firefox和safari(mac))时,我看不到网络视图,该视图保持空白.即UI将被加载并且树将在那里,但是正确的jand痛苦永远不会显示嵌入式视图.

HOWEVER , when viewing this in the browser (i.e. chrome , firefox and safari(mac)) i dont see the web view , it stays blank. i.e. the UI will load and the tree will be there , but the right jand pain never shows the embedded views.

当我以Webstart身份运行时,我会看到正确的视图.嵌入到Web视图中的网页具有登录名,当我尝试登录闪烁的网页时,如刷新和登录表单为空白时,我必须再次输入凭据.

When I run as a webstart I see the right views. The web pages that are embedded into the web views have a login, when i try login the web page flicker , like ther refresh and the login form is blanked, I have to enter the credential again.

不确定哪里出了问题或如何调试浏览器/webstart端.

not sure what is wrong or how to debug the browser / webstart side.

推荐答案

在浏览器中查看此内容(即chrome,firefox和safari(mac))时,我看不到网络视图,但它保持空白.即UI将被加载并且树将在那里,但是正确的jand痛苦永远不会显示嵌入式视图.

when viewing this in the browser (i.e. chrome , firefox and safari(mac)) i dont see the web view , it stays blank. i.e. the UI will load and the tree will be there , but the right jand pain never shows the embedded views.

如果您尚未这样做,则需要对您的应用程序进行签名允许其在浏览器嵌入式Java应用程序沙箱之外运行,以便Webview的网络层有权访问外部位置.

If you not done so already, you will need to sign your application to allow it to run outside of the browser embedded Java application sandbox so that the webview's network layer has permission to access the external locations.

还监视webview loadworker的exception属性,以查看是否遇到异常或FAILED状态:

Also monitor the webview loadworker's exception property to see if an exception or FAILED state was encountered:

Worker worker = webview.getEngine().getLoadWorker();
worker.stateProperty().addListener(new ChangeListener<Worker.State>() {
  @Override public void changed(ObservableValue<? extends Worker.State> observableValue, Worker.State oldState, Worker.State newState) {
    System.out.println("Browser state change: " + newState);
  }
});
worker.exceptionProperty().addListener(new ChangeListener<Throwable>() {
  @Override public void changed(ObservableValue<? extends Throwable> observableValue, Throwable oldThrowable, Throwable newThrowable) {
    System.out.println("Browser encountered a load exception: " + newThrowable);
  }
});

不确定哪里出了问题或如何调试浏览器/webstart端.

not sure what is wrong or how to debug the browser / webstart side.

关于调试Webstart/浏览器嵌入式应用程序的步骤.本文提供了许多指针,例如如何设置调试和跟踪级别等.

There is an excellent Oracle article on debugging steps for webstart / browser embedded applications. The article provides numerous pointers such as how to set debug and trace levels, etc.

这篇关于JavaFX 2.2 Web视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆