package jfxapp; import javafx.application.Platform; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.layout.AnchorPane; import javafx.stage.Modality; import javafx.stage.Stage; import javafx.stage.StageStyle; import javafx.stage.WindowEvent; public class mainForm { @FXML private Button button_E8; @FXML private Button button_E1; @FXML private Button button_E2; @FXML private Button button_E3; @FXML private Button button_E4; @FXML private Button btn_About; @FXML private AnchorPane contentPane; @FXML private Button button_E5; @FXML private Button button_E6; @FXML private Button btn_Quit; @FXML private Button button_E7; @FXML void btn_E1_Click(ActionEvent event) throws Exception { showExam1(new Stage()); } @FXML void btn_E2_Click(ActionEvent event) { } @FXML void btn_E3_Click(ActionEvent event) { } @FXML void btn_E4_Click(ActionEvent event) { } @FXML void btn_E5_Click(ActionEvent event) { } @FXML void btn_E6_Click(ActionEvent event) { } @FXML void btn_E7_Click(ActionEvent event) { } @FXML void btn_E8_Click(ActionEvent event) { } @FXML void btn_About_Click(ActionEvent event) { onAbout(); } @FXML void btn_Quit_Click(ActionEvent event) { onQuit(); } private void showExam1(Stage primaryStage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("/samExam1.fxml")); primaryStage.setTitle("Ukázková úloha č. 1"); primaryStage.setScene(new Scene(root, 1000, 730)); primaryStage.initModality(Modality.APPLICATION_MODAL); primaryStage.show(); } private void dialogMessage(final String text, final String title, final char type) { DialogFX dfx = new DialogFX(); dfx.setTitleText(title); dfx.setMessage(text); switch (type) { case 'A': dfx.setType(DialogFX.Type.ACCEPT); break; case 'E': dfx.setType(DialogFX.Type.ERROR); break; case 'I': dfx.setType(DialogFX.Type.INFO); break; } dfx.showDialog(); } private Integer questMessage(final String text, final String title) { DialogFX dfx = new DialogFX(); dfx.setType(DialogFX.Type.QUESTION); dfx.setTitleText(title); dfx.setMessage(text); return dfx.showDialog(); } private void onAbout() { /* Alert dialog = new Alert(Alert.AlertType.INFORMATION); dialog.setTitle("O programu..."); dialog.setHeaderText("Ukázková aplikace JavaFX"); dialog.setContentText("Seriál článků pro Root.cz"); dialog.showAndWait(); */ //dialogMessage("Ukázková aplikace JavaFX", "O programu...", 'I'); Integer qm = questMessage("Ukázková aplikace JavaFX", "O programu..."); System.out.println(qm.toString()); } private void onQuit() { Platform.exit(); System.out.println("Aplikace byla řádně ukončena"); } }