Java Code Examples for javafx.scene.input.KeyEvent#isConsumed()

The following examples show how to use javafx.scene.input.KeyEvent#isConsumed() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SelectedWidgetUITracker.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void handleKeyEvent(final KeyEvent event)
{
    super.handleKeyEvent(event);
    if (event.isConsumed())
        group_handler.hide();
}
 
Example 2
Source File: Keyboard.java    From jace with GNU General Public License v2.0 5 votes vote down vote up
public void keyReleased(KeyEvent e) {
    KeyCode code = e.getCode();
    processKeyUpEvents(e);
    if (code == null || e.isConsumed()) {
        return;
    }
    
    e.consume();
}
 
Example 3
Source File: Keyboard.java    From jace with GNU General Public License v2.0 4 votes vote down vote up
public void keyPressed(KeyEvent e) {
    processKeyDownEvents(e);
    if (e.isConsumed()) {
        return;
    }
            
    char c = 255;
    if (e.getText().length() > 0) {
        c = e.getText().charAt(0);
    }

    switch (e.getCode()) {
        case LEFT:
        case KP_LEFT:
            c = 8;
            break;
        case RIGHT:
        case KP_RIGHT:
            c = 21;
            break;
        case UP:
        case KP_UP:
            c = 11;
            break;
        case DOWN:
        case KP_DOWN:
            c = 10;
            break;
        case ESCAPE:
            c = 27;
            break;
        case TAB:
            c = 9;
            break;
        case ENTER:
            c = 13;
            break;
        case BACK_SPACE:
            c = 127;
            break;
        default:
    }

    Emulator.computer.getKeyboard().shiftPressed = e.isShiftDown();
    if (e.isShiftDown()) {
        c = fixShiftedChar(c);
    }

    if (e.isControlDown()) {
        if (c == 255) {
            return;
        }
        c = (char) (c & 0x01f);
    }
    
    if (c < 128) {
        pressKey((byte) c);
    }
}