JavaFX virtual keyboard

2019-06-20 13:12发布

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

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.

3条回答
唯我独甜
2楼-- · 2019-06-20 13:31

if you are confused, here, catch:

1.right click your project (in Netbeans)

2.click Properties-->Run-->

3.Fill the [VM Options] with:

  -Dcom.sun.javafx.isEmbedded=true 
  -Dcom.sun.javafx.touch=true 
  -Dcom.sun.javafx.virtualKeyboard=javafx

4.OK,done

查看更多
We Are One
3楼-- · 2019-06-20 13:40

To be sure, you must add the flags

  • -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...)

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.

查看更多
我想做一个坏孩纸
4楼-- · 2019-06-20 13:42

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.

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.

Try:

  • -Dcom.sun.javafx.isEmbedded=true

And maybe also

  • -Dcom.sun.javafx.touch=true
  • -Dcom.sun.javafx.virtualKeyboard=javafx

Some related sketchy info on the internet:

The guys over at javafxports might know more, so you could try asking there if you want more information (if you are targeting one of their devices).

查看更多
登录 后发表回答