import java.util.Arrays; import javafx.application.Platform; import javafx.application.Application; import javafx.event.EventHandler; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.input.KeyEvent; import javafx.scene.input.MouseEvent; import javafx.scene.paint.Paint; import javafx.stage.Stage; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyCodeCombination; import javafx.scene.input.KeyCharacterCombination; //RT-38797 public class KeyComboTest extends Application { static class KeyPair { private String character; private KeyCode code; KeyPair(String character, KeyCode code) { this.character = character; this.code = code; } } @Override public void start(Stage primaryStage) { for (KeyPair kp : Arrays.asList( new KeyPair("\n", KeyCode.ENTER), new KeyPair("\t", KeyCode.TAB))) { KeyCharacterCombination kcc = new KeyCharacterCombination(kp.character); KeyEvent event = new KeyEvent(KeyEvent.KEY_PRESSED, kp.character, "", kp.code, false, false, false, false); System.out.println("KeyCode." + kp.code.getName() + " matches: " + kcc.match(event)); // true (!!!) } Platform.exit(); } }