Providing touch control in JavaFx and Webstart (JNLP)

254 views Asked by At

I want to pass java-vm-args for enabling touch controll in a application, that is deployed via webstart with a JNLP file. Locally in the IDE (Intellij) I provide the following java-vm-args, which is working:

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

Further more the following property is used e.g. for a TextField which works fine if started in the IDE with the above metioned args:

 myTextField.getProperties().put("vkType", "text");

The webstart with the JNLP modified like the following is not working:

[...]
<resources>
  <j2se version="1.8+" java-vm-args="-XX:+UseConcMarkSweepGC -Xmx1024m  -Dcom.sun.javafx.isEmbedded=true -Dcom.sun.javafx.virtualKeyboard=javafx"/>
[...]

The application logs the passed java-vm-args, so I am able to check, wether an argument is passed or not. All desired args are passed except for both the above mentioned args.

How can I provide the above metioned args via webstart / JNLP ?

1

There are 1 answers

0
aw-think On BEST ANSWER

Maybe some of your arguments to the java-vm-args are not explicitly supported by the JNLP as decribed here (scroll down to: "The following java-vm-args are supported by this version").

For touch control add this: -Dcom.sun.javafx.touch=true (found here: https://community.oracle.com/thread/3548421)

Some of them are available per programming:

For example, check if it is embedded:

public void start(Stage stage) {
    boolean isEmbedded = (stage.getWidth() > 0);
    ...
}

And others could be set by the html page that loads the JNLP. Look here to find whats all available:

http://docs.oracle.com/javase/8/docs/technotes/guides/deploy/deployment_toolkit.html#BABJHEJA

A generated JNLP from a JavaFX Project on Netbeans looks like this:

<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="JavaFXPreloaderApp.jnlp">
  <information>
    <title>JavaFXPreloaderApp</title>
    <vendor>None</vendor>
    <description>null</description>
    <offline-allowed/>
  </information>
  <resources>
    <j2se version="1.6+" java-vm-args="-Xms100m -Xmx1024m "  href="http://java.sun.com/products/autodl/j2se"/>
    <jar href="lib/JavaFXPreloader.jar" size="3760" download="progress" />
    <jar href="JavaFXPreloaderApp.jar" size="5636" download="eager" />
  </resources>
  <applet-desc  width="800" height="600" main-class="com.javafx.main.NoJavaFXFallback"  name="JavaFXPreloaderApp" >
    <param name="requiredFXVersion" value="8.0+"/>
  </applet-desc>
  <jfx:javafx-desc  width="800" height="600" main-class="application.JavaFXPreloaderApp"  name="JavaFXPreloaderApp"  preloader-class="preloader.JavaFXPreloader"/>
  <update check="always"/>
</jnlp>