0

After looking at this advice, I tried the same.

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

But when I apply focus on the control at runtime, I get the error below and, also still, only the standard qwerty keyboard is shown to enter text into the textfield.

I found a more recent post here of someone else failing too. I also applied the same runtime config he mentions as below. That does show a "virtual" keyboard on my laptop at runtime but still not the numeric keyboard when testing directly on the phone.

<plugin>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-maven-plugin</artifactId>
    <version>${javafx.plugin.version}</version>
    <executions>
        <execution>
            <id>default-cli</id>
            <configuration>
                <options>
                    <option>-Dcom.sun.javafx.isEmbedded=true</option>
                    <option>-Dcom.sun.javafx.virtualKeyboard=javafx</option>
                </options>
                <mainClass>${main.class}</mainClass>
            </configuration>
        </execution>

Exception in thread "JavaFX Application Thread" java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Integer (java.lang.String and java.lang.Integer are in module java.base of loader 'bootstrap')

Javateer
  • 65
  • 6
  • Is this for desktop only? Virtual keyboard won't work on mobile. This is something for the Attach [KeyboardService](https://github.com/gluonhq/attach/tree/master/modules/keyboard). There is this [issue](https://github.com/gluonhq/attach/issues/165) already filed. – José Pereda Aug 10 '21 at 10:01
  • @JoséPereda I am trying to make this work for mobile. when a user enters data into a field intended only for numbers, they have to either alt-shift the keyboard or long-press the letters that have numbers as their alternative. Either way, it's a slower data entry process. But when presented by Android or iOS with the numeric keypad, the 3x3 grid of buttons allow for much larger buttons. So, the user can type especially fast this way compared with the full QWERTY layout we see as the default. – Javateer Aug 11 '21 at 17:12
  • A while ago I think I faced the same problem and had to build my own PopUp using JavaFX means similar to the answer to the question you refer to under "here". – user7399085 Oct 13 '21 at 11:42

0 Answers0