我是ReactFX新手,我正试图捕获按下的CTRL和C键,以便进行典型的复制操作。
如何有效地将其捕获到流中?到目前为止,我只能做到这一点,但它甚至没有编译.
final EventStream<KeyEvent> keysTyped = EventStreams.eventsOf(myTbl, KeyEvent.KEY_TYPED)
.reduceSuccessions((a,b) -> new KeyCodeCombination(a.getCode(),b.getCode()), 500);发布于 2015-04-23 17:10:56
这对我来说很管用:
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!"));https://stackoverflow.com/questions/29829484
复制相似问题