Example usage for javafx.scene.input KeyCode F1

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

Introduction

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

Prototype

KeyCode F1

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

Click Source Link

Document

Constant for the F1 function key.

Usage

From source file:com.bekwam.examples.javafx.oldscores.ScoresDialogController.java

@FXML
public void initialize() {

    EventHandler<KeyEvent> f1KeyHandler = (evt) -> {

        if (evt.getCode().equals(KeyCode.F1)) {
            try {
                if (logger.isDebugEnabled()) {
                    logger.debug("[OPEN HELP]");
                }/*from w w  w .ja  v a2s.  com*/
                mainViewRef.get().openHelpDialog();
            } catch (IOException exc) {
                String msg = "error showing help dialog";
                logger.error(msg);
                Alert alert = new Alert(Alert.AlertType.ERROR, msg);
                alert.showAndWait();
            }
        }
    };

    txtVerbalScore1995.addEventHandler(KeyEvent.KEY_PRESSED, f1KeyHandler);
    txtVerbalScoreRecentered.addEventHandler(KeyEvent.KEY_PRESSED, f1KeyHandler);
    txtMathScore1995.addEventHandler(KeyEvent.KEY_PRESSED, f1KeyHandler);
    txtMathScoreRecentered.addEventHandler(KeyEvent.KEY_PRESSED, f1KeyHandler);

}

From source file:com.bekwam.examples.javafx.oldscores1.ScoresDialogController.java

@FXML
public void initialize() {

    EventHandler<KeyEvent> f1KeyHandler = (evt) -> {

        if (evt.getCode().equals(KeyCode.F1)) {
            try {
                if (logger.isDebugEnabled()) {
                    logger.debug("[OPEN HELP]");
                }/*from  w w w  . j a  va 2s . c  o  m*/
                if (mainViewRef != null) {
                    if (mainViewRef.get() != null) {
                        mainViewRef.get().openHelpDialog();
                    }
                }
            } catch (IOException exc) {
                String msg = "error showing help dialog";
                logger.error(msg);
                Alert alert = new Alert(Alert.AlertType.ERROR, msg);
                alert.showAndWait();
            }
        }
    };

    txtVerbalScore1995.addEventHandler(KeyEvent.KEY_PRESSED, f1KeyHandler);
    txtVerbalScoreRecentered.addEventHandler(KeyEvent.KEY_PRESSED, f1KeyHandler);
    txtMathScore1995.addEventHandler(KeyEvent.KEY_PRESSED, f1KeyHandler);
    txtMathScoreRecentered.addEventHandler(KeyEvent.KEY_PRESSED, f1KeyHandler);

}

From source file:com.bekwam.examples.javafx.oldscores3.ScoresViewController.java

@FXML
public void initialize() {

    EventHandler<KeyEvent> f1KeyHandler = (evt) -> {

        if (evt.getCode().equals(KeyCode.F1)) {
            try {
                if (logger.isDebugEnabled()) {
                    logger.debug("[OPEN HELP]");
                }//w w  w  . j  av a2 s .c o  m
                navigationDelegate.openHelpDialog();
            } catch (Exception exc) {
                String msg = "error showing help dialog";
                logger.error(msg);
                Alert alert = new Alert(Alert.AlertType.ERROR, msg);
                alert.showAndWait();
            }
        }
    };

    txtVerbalScore1995.addEventHandler(KeyEvent.KEY_PRESSED, f1KeyHandler);
    txtVerbalScoreRecentered.addEventHandler(KeyEvent.KEY_PRESSED, f1KeyHandler);
    txtMathScore1995.addEventHandler(KeyEvent.KEY_PRESSED, f1KeyHandler);
    txtMathScoreRecentered.addEventHandler(KeyEvent.KEY_PRESSED, f1KeyHandler);

}