Example usage for javafx.stage Modality APPLICATION_MODAL

List of usage examples for javafx.stage Modality APPLICATION_MODAL

Introduction

In this page you can find the example usage for javafx.stage Modality APPLICATION_MODAL.

Prototype

Modality APPLICATION_MODAL

To view the source code for javafx.stage Modality APPLICATION_MODAL.

Click Source Link

Document

Defines a modal window that blocks events from being delivered to any other application window.

Usage

From source file:org.ado.biblio.desktop.AppPresenter.java

public void lend() throws SQLException {
    LOGGER.info("lend");

    Stage stage = new Stage();
    final LendView lendView = new LendView();
    final LendPresenter presenter = (LendPresenter) lendView.getPresenter();
    presenter.init(stage, this, bookId);
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setScene(new Scene(lendView.getView()));
    stage.setTitle("Lend Book");
    stage.show();// w  w w .  j a  v a 2s  . co m
}

From source file:com.helegris.szorengeteg.ui.forms.TopicFormView.java

/**
 * Form submission event handler.//from   www.  ja  v a  2 s.c  o m
 *
 * @param event
 */
private void submitTopic(ActionEvent event) {
    if ("".equals(txtName.getText())) {
        Alert alert = new Alert(Alert.AlertType.WARNING);
        alert.setTitle(Messages.msg("alert.missing_data"));
        alert.setHeaderText(Messages.msg("alert.define_name_for_topic"));
        alert.initModality(Modality.APPLICATION_MODAL);

        alert.showAndWait();
        return;
    }
    try {
        prepareTopic();
        setOrdinals();
        getTransactionDone();
        VistaNavigator.getMainView().loadContentTopics();
    } catch (FileNotFoundException ex) {
        alertFileNotFound(ex, imageFile);
    } catch (IOException ex) {
        new ExceptionAlert(ex).showAndWait();
    } catch (MissingDataException ex) {
        alertMissingData();
    } catch (NotFoundException ex) {
        alertFileNotFound(ex, ex.getFile());
    }
}

From source file:jp.co.heppokoact.autocapture.FXMLDocumentController.java

/**
 * ???????????//  w w  w  . j ava2  s.c o  m
 * ????????
 * ???ESC????????
 *
 * @return ???????
 * @throws IOException ?????
 */
private Stage createTransparentStage() throws IOException {
    // ??????????
    Stage transparentStage = new Stage(StageStyle.TRANSPARENT);
    transparentStage.initOwner(anchorPane.getScene().getWindow());
    transparentStage.initModality(Modality.APPLICATION_MODAL);
    transparentStage.setResizable(false);
    Rectangle2D rect = Screen.getPrimary().getVisualBounds();
    transparentStage.setWidth(rect.getWidth());
    transparentStage.setHeight(rect.getHeight());

    // ???
    java.awt.Rectangle awtRect = new java.awt.Rectangle((int) rect.getWidth(), (int) rect.getHeight());
    BufferedImage captureImage = robot.createScreenCapture(awtRect);

    // ??????
    ByteArrayInputStream in = ImageUtil.convToInputStream(captureImage);
    BackgroundImage bgImage = new BackgroundImage(new Image(in), BackgroundRepeat.NO_REPEAT,
            BackgroundRepeat.NO_REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT);
    Pane pane = new Pane();
    pane.setBackground(new Background(bgImage));
    pane.setStyle("-fx-border-color: rgba(255, 255, 0, 0.5); -fx-border-style: solid; -fx-border-width: 15;");

    // ???ESC?????
    Scene scene = new Scene(pane);
    transparentStage.setScene(scene);
    scene.setOnKeyPressed(e -> {
        if (e.getCode() == KeyCode.ESCAPE) {
            transparentStage.close();
        }
    });

    return transparentStage;
}

From source file:com.esri.geoevent.test.performance.ui.OrchestratorController.java

/**
 * Shows the confirmation dialog// w  ww.j  a va 2s  .  c o m
 */
private boolean showConfirmationDialog(String msg) {
    try {
        // Load the fxml file and create a new stage for the popup
        FXMLLoader loader = new FXMLLoader(getClass().getResource("ConfirmationDialog.fxml"));
        Parent page = (Parent) loader.load();
        Stage dialogStage = new Stage();
        dialogStage.setTitle(UIMessages.getMessage("UI_CLOSE_TAB_TITLE"));
        dialogStage.initModality(Modality.APPLICATION_MODAL);
        dialogStage.initOwner(stage);
        Scene scene = new Scene(page);
        dialogStage.setScene(scene);

        // Set the person into the controller
        ConfirmationDialogController controller = loader.getController();
        controller.setDialogStage(dialogStage);
        controller.setConfirmationMsg(msg);

        // Show the dialog and wait until the user closes it
        dialogStage.showAndWait();
        return controller.isOkClicked();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return false;
}

From source file:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java

private void createBannedPlayername(ListView<String> to_update) {
    Stage createBannedPlayername = new Stage();
    createBannedPlayername.setTitle("Add Banned Playername");
    createBannedPlayername.initModality(Modality.APPLICATION_MODAL);

    GridPane gp = new GridPane();
    gp.setPadding(new Insets(25, 25, 25, 25));
    gp.setAlignment(Pos.CENTER);/*  ww  w  .  j  ava2  s .c  om*/
    gp.setVgap(10);
    gp.setHgap(10);

    Text title = new Text("Add Banned Playername");
    title.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20));
    gp.add(title, 0, 0, 2, 1);

    Label newusername = new Label("Ban Playername");
    TextField username = new TextField();
    gp.add(newusername, 0, 1);
    gp.add(username, 1, 1);

    Button finish = new Button("Finish");
    HBox finish_box = new HBox(10);
    finish_box.setAlignment(Pos.CENTER);
    finish_box.getChildren().add(finish);

    finish.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            banned_playernames.remove(username.getText());
            banned_playernames.add(username.getText());
            to_update.setItems(FXCollections.observableArrayList(banned_playernames));
            createBannedPlayername.close();
        }

    });

    gp.add(finish_box, 0, 2, 2, 1);

    Scene sc = new Scene(gp, 300, 175);
    createBannedPlayername.setScene(sc);
    createBannedPlayername.show();
}

From source file:com.esri.geoevent.test.performance.ui.OrchestratorController.java

/**
 * Perform functionality associated with "About" menu selection or CTRL-A.
 *//*w w  w.  j  av  a 2  s.  c  o  m*/
private void provideAboutFunctionality() {
    try {
        // Load the fxml file and create a new stage for the popup
        FXMLLoader loader = new FXMLLoader(getClass().getResource("AboutDialog.fxml"));
        Parent page = (Parent) loader.load();
        Stage dialogStage = new Stage();
        dialogStage.setTitle(UIMessages.getMessage("UI_HELP_ABOUT_MENU_ITEM_LABEL"));
        dialogStage.initModality(Modality.APPLICATION_MODAL);
        dialogStage.initOwner(stage);
        Scene scene = new Scene(page);
        dialogStage.setScene(scene);

        // Set the person into the controller
        AboutDialogController controller = loader.getController();
        controller.setDialogStage(dialogStage);

        // Show the dialog and wait until the user closes it
        dialogStage.showAndWait();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:com.helegris.szorengeteg.ui.forms.TopicFormView.java

private void alertFileNotFound(Exception ex, File file) {
    Alert alert = new Alert(Alert.AlertType.WARNING);
    alert.setTitle(Messages.msg("alert.file_upload_unsuccessful"));
    alert.setHeaderText(Messages.msg("alert.file_not_available"));
    alert.setContentText(Messages.msg("alert.file") + file.getAbsolutePath());
    alert.initModality(Modality.APPLICATION_MODAL);

    alert.showAndWait();/*from  w w  w.j av  a  2  s.com*/
}

From source file:com.helegris.szorengeteg.ui.forms.TopicFormView.java

private void alertMissingData() {
    Alert alert = new Alert(Alert.AlertType.WARNING);
    alert.setTitle(Messages.msg("alert.missing_data"));
    alert.setHeaderText(Messages.msg("alert.missing_word_or_description"));
    alert.initModality(Modality.APPLICATION_MODAL);

    alert.showAndWait();//from  ww  w  .j a v  a 2s.com
}

From source file:ExcelFx.FXMLDocumentController.java

@Override
public void initialize(URL url, ResourceBundle rb) {

    this.Print.setDisable(true);

    footer.setItems(names);//  www .ja  v a2  s .  c o  m
    JsonWrite jsw = new JsonWrite();
    File universityFile = new File("university.json");
    File collegeFile = new File("college.json");
    //File codesFile = new File("codes.json");

    if ((universityFile.exists()) && (collegeFile.exists()) /*&& (codesFile.exists())*/) {
        try {
            this.universityJson.jsonRead("university.json");
            this.collegeJson.jsonRead("college.json");
            //this.codesJson.jsonRead("codes.json");
            this.jsonXLSXData.setAll(universityJson, collegeJson/*, codesJson*/);
        } catch (IOException | ParseException ex) {
            Alert alert = new Alert(Alert.AlertType.INFORMATION);
            alert.setTitle("");
            alert.setHeaderText(" ? ? ");
            alert.setContentText(ex.toString());
            alert.showAndWait();
            Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
        }

    } else {
        try {
            FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("FileOpenFXML.fxml"));
            this.fileOpenParent = (Parent) fxmlLoader.load();
            Stage stage = new Stage();
            stage.initModality(Modality.APPLICATION_MODAL);
            stage.initStyle(StageStyle.DECORATED);
            stage.setTitle(" ");
            stage.setScene(new Scene(this.fileOpenParent));

            stage.showAndWait();
        } catch (Exception e) {
            System.err.println(e);

        }

        this.jsonXLSXData.setAll(universityJson, collegeJson/*, codesJson*/);
    }

}

From source file:frontend.GUIController.java

@FXML
void showAbout(ActionEvent event) {
    /*Dialogs.create()//from  w w  w  .j  ava 2  s .c  o m
    .title("About")
    .message(getLicense())
    .showInformation();*/
    Alert alert = new Alert(AlertType.INFORMATION);
    alert.initOwner(stage);
    alert.initModality(Modality.APPLICATION_MODAL);
    alert.setTitle("SAIL 1.1: About");
    alert.setHeaderText("SAIL 1.1 details");
    alert.setContentText("SAIL 1.1");
    Label label = new Label("SAIL License details:");

    TextArea textArea = new TextArea(getLicense());
    textArea.setEditable(false);
    textArea.setWrapText(true);

    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(textArea, Priority.ALWAYS);
    GridPane.setHgrow(textArea, Priority.ALWAYS);

    GridPane expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    expContent.add(label, 0, 0);
    expContent.add(textArea, 0, 1);

    // Set expandable Exception into the dialog pane.
    alert.getDialogPane().setExpandableContent(expContent);

    alert.showAndWait();

}