java JavaFX 虚拟键盘
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26768523/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JavaFX virtual keyboard
提问by Gillardo
Is there such a thing? I have googled javafx virtual keyboard, but nothing seems to appear that is valid. I saw this article, but no code or example
有这样的事情吗?我在 google 上搜索了 javafx 虚拟键盘,但似乎没有任何内容是有效的。我看到这篇文章,但没有代码或示例
http://docs.oracle.com/javase/8/javafx/user-interface-tutorial/embed.htm
http://docs.oracle.com/javase/8/javafx/user-interface-tutorial/embed.htm
Does anyone have prior experience with a virtual keyboard in a javafx application? I need to be able to show either a normal keyboard or numeric keypad when a textfield is focused.
有没有人有过在 javafx 应用程序中使用虚拟键盘的经验?当文本字段被聚焦时,我需要能够显示普通键盘或数字小键盘。
回答by jewelsea
Yes, there is such a thing as JavaFX virtual keyboard in the Oracle Java 8 distribution, though it is not documented or supported by Oracle outside of the embedded version of JavaFX.
是的,Oracle Java 8 发行版中有 JavaFX 虚拟键盘这样的东西,尽管在 JavaFX 的嵌入式版本之外,Oracle 没有记录或支持它。
However, the virtual keyboard does seem to ship with the Oracle desktop Java 8 JRE and it does seem to work there if you toggle some undocumented and unsupported system properties.
但是,虚拟键盘似乎与 Oracle 桌面 Java 8 JRE 一起提供,如果您切换一些未记录和不受支持的系统属性,它似乎确实可以在那里工作。
Try:
尝试:
-Dcom.sun.javafx.isEmbedded=true
-Dcom.sun.javafx.isEmbedded=true
And maybe also
也许还有
-Dcom.sun.javafx.touch=true
-Dcom.sun.javafx.virtualKeyboard=javafx
-Dcom.sun.javafx.touch=true
-Dcom.sun.javafx.virtualKeyboard=javafx
Some related sketchy info on the internet:
互联网上的一些相关粗略信息:
- Activating touch-enabled controls in JavaFX
- JavaFX 8 Embedded ModeOracle JavaFX forum post.
- JavaFX WebView / WebEngine show on-screen-keyboard automatically for each text input
- 在 JavaFX 中激活支持触摸的控件
- JavaFX 8 嵌入式模式Oracle JavaFX 论坛帖子。
- JavaFX WebView / WebEngine 为每个文本输入自动显示屏幕键盘
The guys over at javafxportsmight know more, so you could try asking there if you want more information (if you are targeting one of their devices).
在以上这些家伙javafxports可能知道更多,所以你可以试着问那里,如果你想了解更多信息(如果你是针对他们的设备之一)。
回答by Surya Hardiansyah
if you are confused, here, catch:
如果你感到困惑,在这里,抓住:
1.right click your project (in Netbeans)
1.右键单击您的项目(在Netbeans中)
2.click Properties-->Run-->
2.点击属性-->运行-->
3.Fill the [VM Options] with:
3.在[VM选项]中填写:
-Dcom.sun.javafx.isEmbedded=true
-Dcom.sun.javafx.touch=true
-Dcom.sun.javafx.virtualKeyboard=javafx
4.OK,done
4.好的,完成
回答by NTwoO
To be sure, you must add the flags
可以肯定的是,您必须添加标志
-Dcom.sun.javafx.isEmbedded=true
-Dcom.sun.javafx.touch=true
-Dcom.sun.javafx.virtualKeyboard=javafx
-Dcom.sun.javafx.isEmbedded=true
-Dcom.sun.javafx.touch=true
-Dcom.sun.javafx.virtualKeyboard=javafx
to the javavm and not to the application... (added as post, since I can't comment...)
到 javavm 而不是应用程序......(添加为帖子,因为我无法评论......)
Is customising the keyboard layout required? check /com/sun/javafx/scene/control/skin/caspian/fxvk.css
in ${JRE/JDK_INSTALL}/jre/lib/ext/jfxrt.jar
for the css fields influencing the keyboard.
是否需要自定义键盘布局?检查 /com/sun/javafx/scene/control/skin/caspian/fxvk.css
中${JRE/JDK_INSTALL}/jre/lib/ext/jfxrt.jar
对影响键盘的CSS领域。