【问题标题】:JavaFX Virtual keyboard is showing in Netbeans but not in distributionJavaFX 虚拟键盘在 Netbeans 中显示,但不在分发中
【发布时间】:2019-01-02 17:39:47
【问题描述】:

我正在尝试使 javaFX 虚拟键盘适用于触摸屏。 Netbeans 一切顺利。

我把这个放在Project->Properties->Run->VM Options:

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

当我在 Netbeans 中运行程序时,键盘会显示出来,当我单击文本字段时它正在工作......一切都很好。

问题是当我构建应用程序并从 dist 文件夹运行 .jar 时,没有更多的键盘......

有什么想法吗?谢谢!!!

【问题讨论】:

  • 运行JAR文件时是否设置系统属性?
  • @Slav 你是什么意思?我昨晚尝试将<target name="-post-jfx-deploy"> <fx:platform> <fx:property name="-Dcom.sun.javafx.isEmbedded" value="true"/> <fx:property name="-Dcom.sun.javafx.touch" value="true"/> <fx:property name="-Dcom.sun.javafx.virtualKeyboard" value="javafx"/> </fx:platform> </target> 放入build.xml 中......但没有任何变化......

标签: javafx touch virtual-keyboard


【解决方案1】:

可以在main函数中传递参数。

System.setProperty("com.sun.javafx.isEmbedded", "true");
System.setProperty("com.sun.javafx.touch", "true");
System.setProperty("com.sun.javafx.virtualKeyboard", "javafx");
       

【讨论】:

  • 这不起作用。必须在运行主函数之前加载 VM 属性...
  • 我的函数`System.out.println("Main");类> app = Class.forName("ma.sofisoft.Main");方法 main = app.getDeclaredMethod("main", String[].class); System.setProperty("com.sun.javafx.isEmbedded", "true"); System.setProperty("com.sun.javafx.touch", "true"); System.setProperty("com.sun.javafx.virtualKeyboard", "javafx"); System.setProperty("java.library.path", ".");对象[] 参数 = 新对象[]{args}; // main.invoke(null, args); Application.launch(args);`
猜你喜欢
  • 2015-01-02
  • 2017-07-16
  • 1970-01-01
  • 2015-01-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多