问题
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?
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.
Solution: the features can be enabled by setting -Dcom.sun.javafx.isEmbedded=true and -Dcom.sun.javafx.touch=true
回答1:
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).
来源:https://stackoverflow.com/questions/23564413/activating-touch-enabled-controls-in-javafx