ReactFX - 如何为 CTRL-C 组合键事件创建流?

ReactFX- How do I create a stream for CTRL-C key combination event?

我是 ReactFX 的新手,我正在尝试捕获为典型的复制操作按下的 CTRL 和 C 键。

如何有效地将其捕获到流中?这是我到目前为止所能得到的,但它甚至没有编译...

final EventStream<KeyEvent> keysTyped = EventStreams.eventsOf(myTbl, KeyEvent.KEY_TYPED)
        .reduceSuccessions((a,b) -> new KeyCodeCombination(a.getCode(),b.getCode()), 500);

这对我有用:

    KeyCombination ctrlC = new KeyCodeCombination(KeyCode.C, KeyCombination.SHORTCUT_DOWN);
    final EventStream<KeyEvent> keysTyped = EventStreams.eventsOf(text, KeyEvent.KEY_PRESSED)
            // the following line, if uncommented, will limit the frequency
            // of processing ctrl-C to not more than once every 0.5 seconds
            // As a side-effect, processing will be delayed by the same amount
            // .reduceSuccessions((a, b) -> b, Duration.ofMillis(500))
            .filter(ctrlC::match);
    keysTyped.subscribe(event -> System.out.println("Ctrl-C pressed!"));