Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8250820

No Combobox selection by using a Windows stylus pen in JavaFX

    XMLWordPrintable

Details

    • x86_64
    • windows_10

    Description

      ADDITIONAL SYSTEM INFORMATION :
      - Windows 10
      - The option "Ignore touch input when I'm using my pen" in the pen utilities of windows must be off
      - Reproduced with JavaFX 13 and above
      - Reproduced on Lenovo Thinkpad X1 Yoga and Dell XPS 15 9570, but I think it should be reproducible with all Windows laptops/tablets that support stylus pen functionality over a touch screen.

      A DESCRIPTION OF THE PROBLEM :
      Windows pen functionality shows a cursor when you get closer with the pen at the touch display without touch really the display.
      JavaFX does not seem to get along with this feature in Windows and therefore no values can be selected in a ComboBox and a RuntimeException is thrown.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Open any JavaFX application with a ComboBox.
      Get closer to the display with a stylus pen so that the pen cursor is visible. At this moment the first touchpoint will be probably registered in JavaFX. At least I think so, because the RuntimeExcpetion can only thrownwith multiple touch points.
      Now click on a ComboBox in a JavaFX application to display the ComboBox popup.
      Very important you have to stay close enough to the display to see the pen cursor, you shouldn't pull back too far, otherwise the error is not reproducible!
      Now you select an entry from the popup in the combo box, but the touch on the display will select the element under the popup and not the entry in the popup.
      I could imagine that JavaFX use the position of the first touch point for the selection, but these touch point is on the main pane and not on the pop-up of the ComboBox.
      If you now move the pen away from the display completely and try to operate with the application again, a runtime exception with the message "Wrong number of touch points reported" is thrown:
      java.lang.RuntimeException: Wrong number of touch points reported
      at javafx.scene.Scene$ScenePeerListener.touchEventEnd(Scene.java:2856) ~[javafx-graphics-13-win.jar:?]
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleEndTouchEvent$28(GlassViewEventHandler.java:1356) ~[javafx-graphics-13-win.jar:?]
      at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleEndTouchEvent$29(GlassViewEventHandler.java:1354) ~[javafx-graphics-13-win.jar:?]
      at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:412) ~[javafx-graphics-13-win.jar:?]
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleEndTouchEvent(GlassViewEventHandler.java:1353) ~[javafx-graphics-13-win.jar:?]
      at com.sun.glass.ui.View.handleEndTouchEvent(View.java:586) ~[javafx-graphics-13-win.jar:?]
      at com.sun.glass.ui.View.notifyEndTouchEvent(View.java:1060) ~[javafx-graphics-13-win.jar:?]
      at com.sun.glass.ui.TouchInputSupport.notifyBeginTouchEvent(TouchInputSupport.java:87) ~[javafx-graphics-13-win.jar:?]
      at com.sun.glass.ui.win.WinGestureSupport.notifyBeginTouchEvent(WinGestureSupport.java:53) ~[javafx-graphics-13-win.jar:?]
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) ~[javafx-graphics-13-win.jar:?]
      at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174) ~[javafx-graphics-13-win.jar:?]
      at java.lang.Thread.run(Thread.java:834) [?:?]


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No exception should be thrown and the entry in the ComboBox pop-up should be selected

      ---------- BEGIN SOURCE ----------
      package org.sample;

      import javafx.application.Application;
      import javafx.geometry.Pos;
      import javafx.scene.Scene;
      import javafx.scene.control.ComboBox;
      import javafx.scene.control.TextField;
      import javafx.scene.layout.GridPane;
      import javafx.stage.Stage;

      public class ComboBoxTouchFormSample extends Application {

          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage primaryStage) {
              GridPane gridpane = new GridPane();
              ComboBox<String> combobox = new ComboBox<>();
              combobox.getItems().addAll("1. Element", "2. Element", "3. Element", "4. Element", "5. Element", "6. Element", "7. Element");
              gridpane.add(combobox, 0, 0);
              gridpane.add(new TextField(), 0, 1);
              gridpane.add(new TextField(), 0, 2);
              gridpane.add(new TextField(), 0, 3);
              gridpane.add(new TextField(), 0, 4);
              gridpane.setAlignment(Pos.CENTER);
              Scene scene = new Scene(gridpane);
              primaryStage.setScene(scene);
              primaryStage.show();
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      The user can turn on the option "Ignore touch input when I'm using my pen" in the pen utilities of Windows.
      Then there are no touch events anymore, because it seems that Windows cast the touch events to mouse events, but of course then the all other touch functionality in a application doesn't work anymore with the pen.

      FREQUENCY : always


      Attachments

        Issue Links

          Activity

            People

              aghaisas Ajit Ghaisas
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: