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

KeyCombination matching is broken (at least on Linux)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8u40
    • 8u40
    • javafx
    • Linux, JDK 8u40-b02

      Below is a test case that shows how KeyCombination matching is broken.
      I'm using JDK 8u40-b02 on Linux.

      import javafx.application.Platform;
      import javafx.embed.swing.JFXPanel;
      import javafx.scene.input.KeyCharacterCombination;
      import javafx.scene.input.KeyCode;
      import javafx.scene.input.KeyEvent;


      public class KeyCombinationTest {

          public static void main(String[] args) {
              new JFXPanel(); // initialize JavaFX

              KeyCharacterCombination a = new KeyCharacterCombination("a");
              KeyCharacterCombination A = new KeyCharacterCombination("A");
              KeyCharacterCombination b = new KeyCharacterCombination("b");
              KeyCharacterCombination B = new KeyCharacterCombination("B");
              KeyCharacterCombination LF = new KeyCharacterCombination("\n");
              KeyCharacterCombination CR = new KeyCharacterCombination("\r");
              KeyCharacterCombination TAB = new KeyCharacterCombination("\t");

              KeyEvent event = new KeyEvent(KeyEvent.KEY_TYPED, "a", "", KeyCode.UNDEFINED, false, false, false, false);

              System.out.println("a match a: " + a.match(event)); // false (!!!)
              System.out.println("A match a: " + A.match(event)); // true (!!!)
              System.out.println("b match a: " + b.match(event)); // false
              System.out.println("B match a: " + B.match(event)); // true (!!!)
              System.out.println("LF match A: " + LF.match(event)); // true (!!!)
              System.out.println("CR match A: " + CR.match(event)); // true (!!!)
              System.out.println("TAB match A: " + TAB.match(event)); // true (!!!)

              Platform.exit();
          }

      }


      OUTPUT:

      a match a: false
      A match a: true
      b match a: false
      B match a: true
      LF match A: true
      CR match A: true
      TAB match A: true

            msladecek Martin Sládeček
            tmikula Tomas Mikula
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: