Example usage for javafx.stage Stage Stage

List of usage examples for javafx.stage Stage Stage

Introduction

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

Prototype

public Stage() 

Source Link

Document

Creates a new instance of decorated Stage .

Usage

From source file:mesclasses.view.JourneeController.java

private Cours openCoursDialog(Cours cours) {

    try {//www.ja v  a2s.  c o m
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(MainApp.class.getResource(Constants.COURS_EDIT_DIALOG));
        AnchorPane page = (AnchorPane) loader.load();

        // Create the dialog Stage.
        Stage dialogStage = new Stage();
        dialogStage.setTitle("Cration d'un cours ponctuel");
        dialogStage.initModality(Modality.WINDOW_MODAL);
        dialogStage.initOwner(primaryStage);
        Scene scene = new Scene(page);
        dialogStage.setScene(scene);
        // Set the person into the controller.
        CoursEditDialogController controller = loader.getController();
        controller.setDialogStage(dialogStage);
        controller.setCours(cours, true);

        dialogStage.showAndWait();
        int status = controller.getStatus();
        if (status >= 0) {
            //update/cancel
            return controller.getCours();
        }
    } catch (IOException e) {
        ModalUtil.alert("Erreur I/O", e.getMessage());
    }
    return null;
}

From source file:jp.ac.tohoku.ecei.sb.metabolome.lims.gui.MainWindowController.java

@Override
public void initialize(URL location, ResourceBundle resources) {
    // Table Study
    initializeTable(tableStudy, StudyImpl.class);
    initializeTable(tablePlate, PlateImpl.class);
    initializeTable(tableSample, SampleImpl.class);
    initializeTable(tableInjection, InjectionImpl.class);
    initializeTable(tableCompound, CompoundImpl.class);
    initializeTable(tableHistory, OperationHistoryImpl.class);

    menuBar.setUseSystemMenuBar(true);/*from  w  w  w . ja va  2 s .  com*/

    commandManager = new CommandManager();
    commandManager.setContext(commandManagerContext);
    final GUICommandPaneFactory commandPaneFactory = new GUICommandPaneFactory(commandManager);
    MetabolomeQC.addCorrectionCommands(commandManager);
    for (Map.Entry<String, Class> commend : commandManager.getCommands().entrySet()) {
        MenuItem menuItem = new MenuItem(commend.getKey());
        menuItem.setText(commend.getKey());
        menuItem.setOnAction(e -> {
            final Stage stage = new Stage();
            stage.initModality(Modality.WINDOW_MODAL);

            Parent guiCommand = commandPaneFactory.getCommandPane(commend.getKey(),
                    (commandEvent, managedCommand) -> {
                        stage.close();
                    });
            BorderPane margins = new BorderPane(guiCommand);
            BorderPane.setMargin(guiCommand, new Insets(10));

            stage.setScene(new Scene(margins));
            stage.initOwner(this.stage);
            stage.showAndWait();
            onRefresh(null);
        });
        correctionMenu.getItems().add(menuItem);
    }

    onRefresh(null);
}

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

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

        // Set the person into the controller
        LoggerDialogController controller = loader.getController();
        controller.setDialogStage(dialogStage);
        controller.setOutputBuffer(outputBuffer.toString());
        controller.onClearLoggerEvent(() -> outputBuffer = new StringBuffer());

        // Show the dialog
        dialogStage.show();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:ExcelFx.FXMLDocumentController.java

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

    this.Print.setDisable(true);

    footer.setItems(names);// w  w w. j a  va 2s .  co 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:com.joliciel.talismane.terminology.viewer.TerminologyViewerController.java

private void showAlert(String text) {
    Stage dialogStage = new Stage();
    dialogStage.initModality(Modality.WINDOW_MODAL);
    dialogStage.setScene(new Scene(VBoxBuilder.create().children(new Text(text), new Button("Ok"))
            .alignment(Pos.CENTER).padding(new Insets(5)).build()));
    dialogStage.show();/*from   ww  w  .j  av a  2 s  .co m*/
}

From source file:com.joliciel.talismane.terminology.viewer.TerminologyViewerController.java

@FXML
protected void handleMenuSettingsPreferences(ActionEvent event) throws Exception {
    Stage preferencesStage = new Stage();
    preferencesStage.initModality(Modality.WINDOW_MODAL);
    FXMLLoader fxmlLoader = new FXMLLoader();
    Parent root = (Parent) fxmlLoader.load(getClass().getResource("preferences.fxml").openStream());

    PreferencesController controller = fxmlLoader.getController();
    controller.setPrimaryStage(preferencesStage);
    controller.setPrimaryController(this);

    preferencesStage.setTitle("Talismane Terminology Viewer Preferences");
    preferencesStage.setScene(new Scene(root, 400, 300));
    preferencesStage.show();/*w  w w  .  java 2  s .  co  m*/
}

From source file:mesclasses.view.JourneeController.java

@FXML
public void openPostIt() {
    try {//from w  ww  . jav  a  2s . c  o  m
        // Load the fxml file and create a new stage for the popup dialog.
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(MainApp.class.getResource(Constants.POSTIT_DIALOG));
        AnchorPane page = (AnchorPane) loader.load();

        // Create the dialog Stage.
        Stage dialogStage = new Stage();
        dialogStage.setTitle("Post-It");
        dialogStage.initModality(Modality.WINDOW_MODAL);
        dialogStage.initOwner(primaryStage);
        Scene scene = new Scene(page);
        dialogStage.setScene(scene);

        // Set the person into the controller.
        PostItDialogController controller = loader.getController();
        controller.setDialogStage(dialogStage);
        controller.setClasse(seanceSelect.getValue().getClasse());

        // Show the dialog and wait until the user closes it
        dialogStage.showAndWait();

    } catch (IOException e) {
        LOG.error(e);
    }
}

From source file:mesclasses.view.JourneeController.java

@FXML
public void openActions() {
    try {//from  w  w  w . j  a va 2s .  c  o m
        // Load the fxml file and create a new stage for the popup dialog.
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(MainApp.class.getResource(Constants.ACTIONS_DIALOG));
        AnchorPane page = (AnchorPane) loader.load();

        // Create the dialog Stage.
        Stage dialogStage = new Stage();
        dialogStage.setTitle("Actions  faire");
        dialogStage.initModality(Modality.NONE);
        dialogStage.initOwner(primaryStage);
        Scene scene = new Scene(page);
        dialogStage.setScene(scene);

        // Set the person into the controller.
        ActionsEnCoursController controller = loader.getController();
        controller.setDialogStage(dialogStage);
        controller.setClasse(seanceSelect.getValue().getClasse());

        // Show the dialog and wait until the user closes it
        dialogStage.showAndWait();

    } catch (IOException e) {
        LOG.error(e);
    }
}

From source file:UI.MainStageController.java

/**
 * shows the correlation table in the analysis view
 */// w w w.  j a  va  2  s . c o  m
@FXML
private void displayCorrelationTable() {
    //Delete whatever's been in the table before
    TableView<String[]> analysisTable = new TableView<>();

    //We want to display correlations and p-Values of every node combination
    double[][] correlationMatrix = AnalysisData.getCorrelationMatrix().getData();
    double[][] pValueMatrix = AnalysisData.getPValueMatrix().getData();
    LinkedList<TaxonNode> taxonList = SampleComparison.getUnifiedTaxonList(LoadedData.getSamplesToAnalyze(),
            AnalysisData.getLevelOfAnalysis());

    //Table will consist of strings
    String[][] tableValues = new String[correlationMatrix.length][correlationMatrix[0].length + 1];

    //Add the values as formatted strings
    for (int i = 0; i < tableValues.length; i++) {
        tableValues[i][0] = taxonList.get(i).getName();
        for (int j = 1; j < tableValues[0].length; j++) {
            tableValues[i][j] = String.format("%.3f", correlationMatrix[i][j - 1]).replace(",", ".") + "\n("
                    + String.format("%.2f", pValueMatrix[i][j - 1]).replace(",", ".") + ")";
        }
    }

    for (int i = 0; i < tableValues[0].length; i++) {
        String columnTitle;
        if (i > 0) {
            columnTitle = taxonList.get(i - 1).getName();
        } else {
            columnTitle = "";
        }
        TableColumn<String[], String> column = new TableColumn<>(columnTitle);
        final int columnIndex = i;
        column.setCellValueFactory(cellData -> {
            String[] row = cellData.getValue();
            return new SimpleStringProperty(row[columnIndex]);
        });
        analysisTable.getColumns().add(column);

        //First column contains taxon names and should be italic
        if (i == 0)
            column.setStyle("-fx-font-style:italic;");
    }

    for (int i = 0; i < tableValues.length; i++) {
        analysisTable.getItems().add(tableValues[i]);
    }

    //Display table on a new stage
    Stage tableStage = new Stage();
    tableStage.setTitle("Correlation Table");
    BorderPane tablePane = new BorderPane();
    Button exportCorrelationsButton = new Button("Save correlation table to CSV");
    Button exportPValuesButton = new Button("Save p-value table to CSV");
    exportCorrelationsButton.setOnAction(e -> exportTableToCSV(tableValues, false));
    exportPValuesButton.setOnAction(e -> exportTableToCSV(tableValues, true));
    HBox exportBox = new HBox(exportCorrelationsButton, exportPValuesButton);
    exportBox.setPadding(new Insets(10));
    exportBox.setSpacing(10);
    tablePane.setTop(exportBox);
    tablePane.setCenter(analysisTable);
    Scene tableScene = new Scene(tablePane);
    tableStage.setScene(tableScene);
    tableStage.show();
}

From source file:view.FXApplicationController.java

@FXML
protected void aboutAction() {
    Stage stage = new Stage();
    AnchorPane addGrid = new AnchorPane();

    // Creating FXML Loader
    FXMLLoader loader = new FXMLLoader(FXStartController.class.getResource("About.fxml"));
    loader.setController(this);

    // Try to load fxml file
    try {//from  w  w w .ja  va 2  s .  co m
        addGrid = loader.load();
    } catch (IOException e) {
        System.err.println("Error during loading About.fxml file!");
    }

    Scene scene = new Scene(addGrid);

    stage.setResizable(false);
    stage.setScene(scene);

    stage.show();

    stage.setTitle("About");
}