在 JavaFX 中激活触控控件 [英] Activating touch-enabled controls in JavaFX
问题描述
我想使用 http://docs.oracle.com/javase/8/javafx/user-interface-tutorial/embed.htm.我在 Windows 8
平板电脑上构建我的应用程序,但是 ScrollPanes
是桌面风格的,即带有 scrollbars
并且对手指没有反应 -拖着.如何告诉 JavaFX
我在移动平台上?
I want to use the touch-enabled controls described in http://docs.oracle.com/javase/8/javafx/user-interface-tutorial/embed.htm. I'm building my application on a Windows 8
tablet, but the ScrollPanes
are desktop-style, i.e. with scrollbars
and no reaction to finger-dragging. How do I tell JavaFX
that I'm on a mobile platform?
编辑:我刚刚意识到标准的桌面样式 ScrollPane 确实会对手指拖动做出反应,但它看起来不像链接中的示例以上.
Edit: I just realized that the standard, desktop-style ScrollPane does react to finger-dragging, but it doesn't look like the example one in the link above.
解决方案:可以通过设置 -Dcom.sun.javafx.isEmbedded=true 和 -Dcom.sun.javafx.touch=true 来启用这些功能
Solution: the features can be enabled by setting -Dcom.sun.javafx.isEmbedded=true and -Dcom.sun.javafx.touch=true
推荐答案
应该不需要启用这些功能,但 JavaFX 会自行决定是否支持它们.您可以以编程方式查询功能,例如由 PlatformImpl.isSupported(ConditionalFeature.INPUT_TOUCH)
.
There should not be a need to enable these capabilities, but JavaFX decides by itself if they are supported. You can query the capabilities programmatically, e.g. by PlatformImpl.isSupported(ConditionalFeature.INPUT_TOUCH)
.
这篇关于在 JavaFX 中激活触控控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!