Example usage for javafx.scene.input KeyCode SUBTRACT

List of usage examples for javafx.scene.input KeyCode SUBTRACT

Introduction

In this page you can find the example usage for javafx.scene.input KeyCode SUBTRACT.

Prototype

KeyCode SUBTRACT

To view the source code for javafx.scene.input KeyCode SUBTRACT.

Click Source Link

Document

Constant for the Subtract key.

Usage

From source file:ambroafb.general.countcombobox.CountComboBox.java

private void addKeyListeners() {
    KeyCode plus = KeyCode.ADD;/*from w w w.  j  av  a 2  s  .  com*/
    KeyCode minus = KeyCode.SUBTRACT;
    setOnKeyPressed((KeyEvent event) -> {
        KeyCode eventKey = event.getCode();
        CountComboBoxItem selectedItem = getSelectionModel().getSelectedItem();
        if (selectedItem == null)
            return;
        CountComboBoxContainer selectedDrawItem = containers.get(selectedItem.getUniqueIdentifier());

        if (eventKey.equals(plus)) {
            selectedDrawItem.increaseNumberBy(counter);
        } else if (eventKey.equals(minus)) {
            selectedDrawItem.decreaseNumberBy(counter);
        }
        refreshButtonCell();
    });
}