1

私は ReactFX を初めて使用し、典型的なコピー操作で押されている CTRL キーと C キーをキャプチャしようとしています。

これを効果的にストリームに取り込むにはどうすればよいですか? これは私がこれまでに得たすべてですが、コンパイルさえしていません...

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

1 に答える 1

1

これは私のために働く:

    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!"));
于 2015-04-23T17:10:56.723 に答える