All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.fxmisc.wellbehaved.event.KeyCodePatternCombination Maven / Gradle / Ivy

There is a newer version: 1.11
Show newest version
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());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy