JavaFX Virtual Keyboard doesn't show

北城以北 提交于 2020-01-04 09:56:46

问题


I'm new to javafx. I made a simple app form. It has

  • Anchor Pane
  • Pane
  • Text field

I run that app on touch screen device, but the virtual keyboard doesn't show up. The textfield already focused.

I'm using JDK 8u25, scene builder 2.0.

According to what I read, http://docs.oracle.com/javase/8/javafx/user-interface-tutorial/embed.htm

The virtual keyboard is shown automatically when a text input field is in focus. Note that the control that is associated with the keyboard remains visible when the keyboard is displayed. There is no need to push the parent stage up.

What should I do? Thanks in advance.


回答1:


Adding the following arguments to your VM Options should allow the virtual keyboard to pop up:

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

After that, you can specify the keyboard format as indicated in the JavaFX: Working with JavaFX UI Components document.

For example, on a TextField named textField, use the following:

textField.getProperties().put("vkType", "numeric");


来源:https://stackoverflow.com/questions/26777350/javafx-virtual-keyboard-doesnt-show

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!