当前位置: 首页>>代码示例>>Java>>正文


Java Parent.setOnKeyPressed方法代码示例

本文整理汇总了Java中javafx.scene.Parent.setOnKeyPressed方法的典型用法代码示例。如果您正苦于以下问题:Java Parent.setOnKeyPressed方法的具体用法?Java Parent.setOnKeyPressed怎么用?Java Parent.setOnKeyPressed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.Parent的用法示例。


在下文中一共展示了Parent.setOnKeyPressed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: openHelp

import javafx.scene.Parent; //导入方法依赖的package包/类
@FXML
public void openHelp(ActionEvent event) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/helpPopup.fxml"));
    final Scene scene = new Scene(root);
    final Stage stage = new Stage();
    stage.setTitle("Help");
    stage.setScene(scene);
    stage.show();
    stage.setResizable(false);
    stage.centerOnScreen();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.close();
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:21,代码来源:searchLugController.java

示例2: openSubmit2

import javafx.scene.Parent; //导入方法依赖的package包/类
@FXML
public void openSubmit2(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Submit.fxml"));
    final Scene hScene = new Scene(home);
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Submit2.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:21,代码来源:submitController.java

示例3: openSubmitAction

import javafx.scene.Parent; //导入方法依赖的package包/类
@FXML
public void openSubmitAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Submit.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:21,代码来源:submitController.java

示例4: openHome

import javafx.scene.Parent; //导入方法依赖的package包/类
@FXML
public void openHome(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
    stage.centerOnScreen();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode() + " Made by ShaMaster");
                stage.setScene(hScene);
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:22,代码来源:searchLugController.java

示例5: openHome

import javafx.scene.Parent; //导入方法依赖的package包/类
/**
 *
 * @author shabier
 */
    @FXML
    public void openHome(ActionEvent event) throws IOException {
//        MyJDBC.createTestDatabase("shabo");
        Node node = (Node) event.getSource();
        final Stage stage = (Stage) node.getScene().getWindow();
        Parent root = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
        Scene scene = new Scene(root);
        stage.setScene(scene);
        stage.show();
        stage.centerOnScreen();

        final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
        final Scene hScene = new Scene(home);
        root.setOnKeyPressed(new EventHandler<KeyEvent>() {
            public void handle(KeyEvent ke) {
                if (ke.getCode() == KeyCode.ESCAPE) {
                    System.out.println("Key Pressed: " + ke.getCode() + " Made by ShaMaster");
                    stage.setScene(hScene);
                }
            }
        });
    }
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:27,代码来源:homepageController.java

示例6: openContact

import javafx.scene.Parent; //导入方法依赖的package包/类
@FXML
public void openContact(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Contact.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:21,代码来源:homepageController.java

示例7: openSeachLugAction

import javafx.scene.Parent; //导入方法依赖的package包/类
@FXML
public void openSeachLugAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/SearchLug.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:21,代码来源:homepageController.java

示例8: openStatisticsAction

import javafx.scene.Parent; //导入方法依赖的package包/类
@FXML
public void openStatisticsAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Statistics.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:21,代码来源:homepageController.java

示例9: openCreditsAction

import javafx.scene.Parent; //导入方法依赖的package包/类
@FXML
public void openCreditsAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Credits.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:21,代码来源:homepageController.java

示例10: openFAQ

import javafx.scene.Parent; //导入方法依赖的package包/类
@FXML
public void openFAQ(final ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    final Parent root = FXMLLoader.load(getClass().getResource("/fxml/FAQ.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:21,代码来源:contactController.java

示例11: openHome

import javafx.scene.Parent; //导入方法依赖的package包/类
@FXML
public void openHome(ActionEvent event) throws IOException {
    MyJDBC.createTestDatabase("shabo");
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
    stage.centerOnScreen();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode() + " Made by ShaMaster");
                stage.setScene(hScene);
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:23,代码来源:contactController.java

示例12: backToCreditsAction

import javafx.scene.Parent; //导入方法依赖的package包/类
@FXML
public void backToCreditsAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Credits.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:21,代码来源:contactController.java

示例13: openSubmitAction

import javafx.scene.Parent; //导入方法依赖的package包/类
@FXML
public void openSubmitAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();

    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Submit.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:22,代码来源:contactController.java

示例14: openHome

import javafx.scene.Parent; //导入方法依赖的package包/类
@FXML
public void openHome(ActionEvent event) throws IOException {
    MyJDBC.createTestDatabase("shabo");
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
    stage.centerOnScreen();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode() + " Made by ShaMaster");
                stage.setScene(hScene);
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:23,代码来源:submitController.java

示例15: openSubmitAction

import javafx.scene.Parent; //导入方法依赖的package包/类
@FXML
public void openSubmitAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Submit.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:21,代码来源:homepageController.java


注:本文中的javafx.scene.Parent.setOnKeyPressed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。