有没有办法在JavaFX WebView中停止用户输入?

huangapple go评论88阅读模式
英文:

Is there a way to stop User Input in a JavaFX WebView?

问题

我正在制作一个类似于这样的JavaFX WebView:

WebView webView = new WebView();
WebEngine webEngine = webView.getEngine();
webEngine.loadContent("www.google.com");

我成功地使用了 loadContent(String URL) 方法将嵌入的YouTube视频加载到JavaFX WebView中,允许用户观看视频。此外,我还向视频URL添加了一些参数,以删除某些视频方面,如视频控件,全屏等。由于我无法使用这些JQuery参数禁用用户的暂停或取消暂停输入,因此我必须找到一种方法让WebView禁用所有用户输入,包括键盘,鼠标等。是否有任何可能的方法可以帮助我控制这一点?谢谢。

英文:

I was making a JavaFX WebView similar to this:

WebView webView = new WebView();
WebEngine webEngine = webView.getEngine();
webEngine.loadContent("www.google.com");

I managed to use the loadContent(String URL) method to load an Embed Youtube video into a JavaFX WebView, allowing the user to watch the video. Additionally, I have added some parameters to the video URL to remove certain video aspects such as the video controls, full screen, etc. Because I can't disable user input from pausing or unpausing using these JQuery Parameters, I must find a way for a WebView to disable all user input, including keyboard, mouse, etc. Is there any possible method that would help me control this? Thanks.

答案1

得分: 1

根据James_D的说法,使用WebView.setDisable(true)将禁用与节点的用户交互。问题解决。

英文:

As what James_D said, using the WebView.setDisable(true) will disable user interaction with the node. Problem solved

huangapple
  • 本文由 发表于 2020年9月1日 08:34:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/63679837.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定