本文整理汇总了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();
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}