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

The following examples show how to use javafx.scene.input.KeyEvent#getText() . 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: DataAnalysisController.java    From MyBox with Apache License 2.0 6 votes vote down vote up
@Override
public void controlHandler(KeyEvent event) {
    if (!event.isControlDown()) {
        return;
    }
    String key = event.getText();
    if (key != null) {
        switch (key) {
            case "q":
            case "Q":
                queryData();
                return;
            case "e":
            case "E":
                exportData();
                return;
            case "r":
            case "R":
                clearAction();
        }
    }
    super.controlHandler(event);
}
 
Example 2
Source File: ImageManufactureController.java    From MyBox with Apache License 2.0 6 votes vote down vote up
@Override
public void altHandler(KeyEvent event) {
    super.altHandler(event);
    if (event.isAltDown()) {
        String key = event.getText();
        if (key == null || key.isEmpty()) {
            return;
        }
        switch (key) {
            case "p":
            case "P":
                if (!popButton.isDisabled()) {
                    popAction();
                }
                break;
            default:
                break;
        }
    }
}
 
Example 3
Source File: ImageManufactureController.java    From MyBox with Apache License 2.0 6 votes vote down vote up
@Override
public void controlHandler(KeyEvent event) {
    super.controlHandler(event);
    if (event.isControlDown()) {
        String key = event.getText();
        if (key == null || key.isEmpty()) {
            return;
        }
        switch (key) {
            case "p":
            case "P":
                if (!popButton.isDisabled()) {
                    popAction();
                }
                break;
            default:
                break;
        }
    }
}
 
Example 4
Source File: ChromaticityDiagramController.java    From MyBox with Apache License 2.0 6 votes vote down vote up
@Override
public void keyEventsHandler(KeyEvent event) {
    super.keyEventsHandler(event);
    if (event.isControlDown()) {
        String key = event.getText();
        if (key == null || key.isEmpty()) {
            return;
        }
        switch (key) {
            case "2":
                paneSizeDiagram();
                break;
            case "3":
                zoomInDiagram();
                break;
            case "4":
                zoomOutDiagram();
                break;
        }

    }
}
 
Example 5
Source File: ImageManufactureBatchEnhancementController.java    From MyBox with Apache License 2.0 6 votes vote down vote up
@Override
public void keyEventsHandler(KeyEvent event) {
    super.keyEventsHandler(event);
    if (event.isControlDown()) {
        String key = event.getText();
        if (key == null || key.isEmpty()) {
            return;
        }
        switch (key) {
            case "k":
            case "K":
                if (stringBox != null) {
                    stringBox.show();
                }
                break;
        }
    }
}
 
Example 6
Source File: ImageManufactureBatchEffectsController.java    From MyBox with Apache License 2.0 6 votes vote down vote up
@Override
public void keyEventsHandler(KeyEvent event) {
    super.keyEventsHandler(event);
    if (event.isControlDown()) {
        String key = event.getText();
        if (key == null || key.isEmpty()) {
            return;
        }
        switch (key) {
            case "k":
            case "K":
                if (stringBox != null) {
                    stringBox.show();
                }
                break;
        }
    }
}
 
Example 7
Source File: ImageViewerController.java    From MyBox with Apache License 2.0 6 votes vote down vote up
@Override
public void keyEventsHandler(KeyEvent event) {
    super.keyEventsHandler(event);
    if (event.isControlDown()) {
        String key = event.getText();
        if (key == null || key.isEmpty()) {
            return;
        }
        switch (key) {
            case "t":
            case "T":
                if (selectAreaCheck != null) {
                    selectAreaCheck.setSelected(!selectAreaCheck.isSelected());
                }
                break;
            default:
                break;
        }
    }
}
 
Example 8
Source File: MyBoxLanguagesController.java    From MyBox with Apache License 2.0 6 votes vote down vote up
@Override
public void altHandler(KeyEvent event) {
    super.altHandler(event);
    if (!event.isAltDown()) {
        return;
    }
    String key = event.getText();
    if (key == null || key.isEmpty()) {
        return;
    }
    switch (key) {
        case "e":
        case "E":
            copyEnglish();
            return;

    }
}
 
Example 9
Source File: MyBoxLanguagesController.java    From MyBox with Apache License 2.0 6 votes vote down vote up
@Override
public void controlHandler(KeyEvent event) {
    super.controlHandler(event);
    if (!event.isControlDown()) {
        return;
    }
    String key = event.getText();
    if (key == null || key.isEmpty()) {
        return;
    }
    switch (key) {
        case "e":
        case "E":
            copyEnglish();
            return;

    }
}
 
Example 10
Source File: DataAnalysisController.java    From MyBox with Apache License 2.0 6 votes vote down vote up
@Override
public void altHandler(KeyEvent event) {
    if (!event.isAltDown()) {
        return;
    }
    String key = event.getText();
    if (key != null) {
        switch (key) {
            case "q":
            case "Q":
                queryData();
                return;
            case "e":
            case "E":
                exportData();
                return;
            case "r":
            case "R":
                clearAction();
        }
    }
    super.altHandler(event);
}
 
Example 11
Source File: MediaPlayerController.java    From MyBox with Apache License 2.0 5 votes vote down vote up
@Override
public void keyHandler(KeyEvent event) {
    super.keyHandler(event);

    String text = event.getText();
    if (text == null || text.isEmpty()) {
        return;
    }
    switch (text) {
        case "s":
        case "S":
            playButton.fire();
            return;
        case "q":
        case "Q":
            stopButton.fire();
            return;
        case "m":
        case "M":
            soundButton.fire();
            return;
        case "f":
        case "F":
            fullScreenButton.fire();

    }
}
 
Example 12
Source File: ImageBaseController.java    From MyBox with Apache License 2.0 5 votes vote down vote up
@Override
public void keyEventsHandler(KeyEvent event) {
    super.keyEventsHandler(event);
    if (event.isControlDown()) {
        String key = event.getText();
        if (key == null || key.isEmpty()) {
            return;
        }
        switch (key) {
            case "1":
                if (imageSizeButton != null && !imageSizeButton.isDisabled()) {
                    loadedSize();
                }
                break;
            case "2":
                if (paneSizeButton != null && !paneSizeButton.isDisabled()) {
                    paneSize();
                }
                break;
            case "3":
                if (zoomInButton != null && !zoomInButton.isDisabled()) {
                    zoomIn();
                }
                break;
            case "4":
                if (zoomOutButton != null && !zoomOutButton.isDisabled()) {
                    zoomOut();
                }
                break;
        }

    }
}
 
Example 13
Source File: GameElimniationController.java    From MyBox with Apache License 2.0 5 votes vote down vote up
@Override
public void keyHandler(KeyEvent event) {
    super.keyHandler(event);
    String text = event.getText();
    if (text == null || text.isEmpty()) {
        return;
    }
    switch (text) {
        case "h":
        case "H":
            helpMeAction();
    }
}
 
Example 14
Source File: ImageManufactureColorController.java    From MyBox with Apache License 2.0 5 votes vote down vote up
@Override
public void eventsHandler(KeyEvent event) {
    keyEventsHandlerDo(event);
    if (!event.isAltDown()) {
        return;
    }
    String key = event.getText();
    if (key == null || key.isEmpty()) {
        return;
    }
    switch (key) {
        case "1":
            if (opBox.getChildren().contains(setButton) && !setButton.isDisabled()) {
                setAction();
            }
            break;
        case "2":
            if (opBox.getChildren().contains(colorIncreaseButton) && !colorIncreaseButton.isDisabled()) {
                increaseAction();
            }
            break;
        case "3":
            if (opBox.getChildren().contains(colorDecreaseButton) && !colorDecreaseButton.isDisabled()) {
                decreaseAction();
            }
            break;
        case "4":
            if (opBox.getChildren().contains(colorFilterButton) && !colorFilterButton.isDisabled()) {
                filterAction();
            }
            break;
        case "5":
            if (opBox.getChildren().contains(colorInvertButton) && !colorInvertButton.isDisabled()) {
                invertAction();
            }
            break;
    }

}
 
Example 15
Source File: EpochController.java    From dev-tools with Apache License 2.0 5 votes vote down vote up
@FXML
private void handleTimeZoneSearch(KeyEvent keyEvent) {
    String key = keyEvent.getText();
    if (key.length() == 0) return;
    int i = 0;
    for (String item : timeZoneComboBox.getItems()) {
        if (item.toLowerCase().startsWith(key) && i > timeZoneComboBoxIndex) {
            timeZoneComboBox.setValue(item);
            timeZoneComboBoxIndex = i;
            return;
        }
        i++;
    }
    timeZoneComboBoxIndex = 0;
}
 
Example 16
Source File: ComboBoxKeyHandler.java    From metastone with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handle(KeyEvent event) {
	if (System.currentTimeMillis() - WORD_DELAY > lastKeyPress) {
		s = "";
	}
	// handle non alphanumeric keys like backspace, delete etc
	if (event.getCode() == KeyCode.BACK_SPACE && s.length() > 0)
		s = s.substring(0, s.length() - 1);
	else
		s += event.getText();

	lastKeyPress = System.currentTimeMillis();

	if (s.length() == 0) {
		select(0);
		return;
	}

	for (T item : box.getItems()) {

		String name = box.getConverter().toString(item).toLowerCase();
		if (name.startsWith(s)) {
			select(item);
			return;
		}
	}
	// nothing found, reset search string
	s = "";
}
 
Example 17
Source File: FileEditerController.java    From MyBox with Apache License 2.0 4 votes vote down vote up
@Override
public void keyEventsHandler(KeyEvent event) {
    super.keyEventsHandler(event);

    if (event.isControlDown()) {
        String key = event.getText();
        if (key == null || key.isEmpty()) {
            return;
        }
        switch (key) {
            case "1":
                if (!findFirstButton.isDisabled()) {
                    findFirstAction();
                }
                break;
            case "2":
                if (!findPreviousButton.isDisabled()) {
                    findPreviousAction();
                }
                break;
            case "3":
                if (!findNextButton.isDisabled()) {
                    findNextAction();
                }
                break;
            case "4":
                if (!findLastButton.isDisabled()) {
                    findLastAction();
                }
                break;
            case "q":
                if (!replaceButton.isDisabled()) {
                    replaceAction();
                }
                break;
            case "w":
                if (!replaceAllButton.isDisabled()) {
                    replaceAllAction();
                }
                break;
        }

    }

    if (event.isAltDown()) {
        switch (event.getCode()) {
            case PAGE_UP:
                if (!pagePreviousButton.isDisabled()) {
                    pagePreviousAction();
                }
                break;
            case PAGE_DOWN:
                if (!pageNextButton.isDisabled()) {
                    pageNextAction();
                }
                break;
            case HOME:
                if (!pageFirstButton.isDisabled()) {
                    pageFirstAction();
                }
                break;
            case END:
                if (!pageLastButton.isDisabled()) {
                    pageLastAction();
                }
                break;
        }

    }

}
 
Example 18
Source File: WSRecorder.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
@Override
public void recordRawKeyEvent(RFXComponent r, KeyEvent e) {
    JSONObject event = new JSONObject();
    event.put("type", "key_raw");
    KeyCode keyCode = e.getCode();
    if (keyCode.isModifierKey()) {
        return;
    }
    if ((keyCode.isFunctionKey() || keyCode.isArrowKey() || keyCode.isKeypadKey() || keyCode.isMediaKey()
            || keyCode.isNavigationKey() || e.isControlDown() || e.isMetaDown() || e.isAltDown()
            || needManualRecording(keyCode)) && e.getEventType() == KeyEvent.KEY_PRESSED) {
        String mtext = buildModifiersText(e);
        event.put("modifiersEx", mtext);
        KeysMap keysMap = KeysMap.findMap(e.getCode());
        if (keysMap == KeysMap.NULL) {
            return;
        }
        String keyText;
        if (keysMap == null) {
            keyText = e.getText();
        } else {
            keyText = keysMap.toString();
        }
        event.put("keyCode", keyText);
    } else if (e.getEventType() == KeyEvent.KEY_TYPED && !e.isControlDown() && !needManualRecording(keyCode)) {
        char[] cs = e.getCharacter().toCharArray();
        if (cs.length == 0) {
            return;
        }
        for (char c : cs) {
            if (Character.isISOControl(c) && hasMapping(c)) {
                event.put("keyChar", getMapping(c));
            } else {
                event.put("keyChar", "" + c);
            }
        }
    } else {
        return;
    }
    recordEvent(r, event);
}