org.fxmisc.wellbehaved.event.KeyCodePatternCombination Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of richtextfx Show documentation
Show all versions of richtextfx Show documentation
FX-Text-Area for formatted text and other special effects.
package org.fxmisc.wellbehaved.event;
import java.util.function.Predicate;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCombination;
import javafx.scene.input.KeyEvent;
class KeyCodePatternCombination extends KeyCombination {
private final Predicate keyTest;
KeyCodePatternCombination(Predicate keyTest, KeyCombination.Modifier... modifiers) {
super(modifiers);
this.keyTest = keyTest;
}
@Override
public boolean match(KeyEvent event) {
return super.match(event) // matches the modifiers
&& keyTest.test(event.getCode());
}
}