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:genrsa.GenRSAController.java

/**
 * Mtodo usado para cargar la ventana de Cifra
 * @param event //from   w  w w  . j a  v  a2 s. c  om
 */
public void DeCipher(ActionEvent event) {
    FXMLLoader fxmlLoader;
    Parent root;
    int iterator;

    try {
        secondStage = new Stage();
        fxmlLoader = new FXMLLoader(getClass().getResource("/DeCipher/DeCipher.fxml"));
        root = fxmlLoader.load();

        DeCipherController DeCipherCtr = fxmlLoader.<DeCipherController>getController();

        DeCipherCtr.setPubKeyBI(this.RSA.getE());
        DeCipherCtr.setModulusBI(this.RSA.getN());
        DeCipherCtr.setRadix(this.radix);

        //parte grfica
        DeCipherCtr.getModulus().setText(
                this.utilidades.putPoints(this.RSA.getN().toString(this.radix).toUpperCase(), this.radix));
        DeCipherCtr.getPubKey().setText(
                this.utilidades.putPoints(this.RSA.getE().toString(this.radix).toUpperCase(), this.radix));

        DeCipherCtr.getModulus1().setText(
                this.utilidades.putPoints(this.RSA.getN().toString(this.radix).toUpperCase(), this.radix));
        //obtengo todas las claves privadas parejas
        String[] PPK = this.claves_parejas.getText().split("\n");

        //las meto en el comboBox
        ComboBox comboBox = DeCipherCtr.getPrivKeys();
        comboBox.getItems().add("Clave Privada");
        comboBox.getItems()
                .add(this.utilidades.putPoints(this.RSA.getD().toString(this.radix).toUpperCase(), this.radix));
        comboBox.getItems().add("Claves Privadas Parejas");
        for (iterator = 0; iterator < PPK.length; iterator++) {
            comboBox.getItems().add(PPK[iterator]);
        }
        comboBox.setValue(
                this.utilidades.putPoints(this.RSA.getD().toString(this.radix).toUpperCase(), this.radix));
        comboBox.setVisibleRowCount(7);

        disableOnProgress(true);

        Scene scene = new Scene(root);
        secondStage.initModality(Modality.NONE);
        secondStage.getIcons()
                .add(new Image(GenRSAController.class.getResourceAsStream("/allImages/genRSA.png")));
        secondStage.setTitle("genRSA - Cifrado y Descifrado");
        secondStage.setScene(scene);
        secondStage.show();

        secondStage.setOnCloseRequest(closeEvent -> {
            this.disableOnProgress(false);
            this.disableButtons();
        });

    } catch (IOException ex) {
        //no pongo mensaje de error, porque no se puede dar el caso
    }

}

From source file:com.cdd.bao.editor.EditSchema.java

public void actionFileBrowse() {
    String endpoint = EditorPrefs.getSparqlEndpoint();

    if (endpoint == null || endpoint.length() == 0) {
        Util.informWarning("Browse",
                "You need to setup a SPARQL endpoint first: use the Configuration dialog.");
        return;/*from   w ww  . ja v  a 2  s .c  o m*/
    }

    Stage stage = new Stage();
    BrowseEndpoint browse = new BrowseEndpoint(stage);
    stage.show();
}

From source file:com.github.drbookings.ui.controller.MainController.java

private void showAddBookingDialog(final LocalDate date, final String roomName) {
    try {/*from   ww w  .j  a  va2  s.c o  m*/
        final FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/AddBookingView.fxml"));
        final Parent root = loader.load();
        final Stage stage = new Stage();
        stage.setWidth(300);
        stage.setHeight(600);
        final Scene scene = new Scene(root);
        stage.setTitle("Add BookingBean");
        stage.setScene(scene);
        final AddBookingController c = loader.getController();
        c.setManager(manager);
        c.datePickerCheckIn.setValue(date);
        c.comboBoxRoom.getSelectionModel().select(roomName);
        final Stage windowStage = (Stage) node.getScene().getWindow();
        stage.initOwner(windowStage);
        stage.initModality(Modality.WINDOW_MODAL);
        stage.setX(windowStage.getX() + windowStage.getWidth() / 2 - stage.getWidth() / 2);
        stage.setY((windowStage.getY() + windowStage.getHeight()) / 2 - stage.getHeight() / 2);
        stage.show();
    } catch (final IOException e) {
        logger.error(e.getLocalizedMessage(), e);
    }
}

From source file:genrsa.GenRSAController.java

/**
 * Mtodo usado para cargar la ventana de Firma
 * @param event /*  www  .  j  av  a  2 s. com*/
 */
public void Sign(ActionEvent event) {
    FXMLLoader fxmlLoader;
    Parent root;
    int iterator;

    try {
        secondStage = new Stage();
        fxmlLoader = new FXMLLoader(getClass().getResource("/Sign/Sign.fxml"));
        root = fxmlLoader.load();

        SignController SignCtr = fxmlLoader.<SignController>getController();

        SignCtr.setPubKeyBI(this.RSA.getE());
        SignCtr.setModulusBI(this.RSA.getN());
        SignCtr.setRadix(this.radix);

        //parte grfica
        SignCtr.getModulus().setText(
                this.utilidades.putPoints(this.RSA.getN().toString(this.radix).toUpperCase(), this.radix));
        SignCtr.getPubKey().setText(
                this.utilidades.putPoints(this.RSA.getE().toString(this.radix).toUpperCase(), this.radix));

        SignCtr.getModulus1().setText(
                this.utilidades.putPoints(this.RSA.getN().toString(this.radix).toUpperCase(), this.radix));
        //obtengo todas las claves privadas parejas
        String[] PPK = this.claves_parejas.getText().split("\n");
        //quito la informacion acerca de los bits "--> XXbits"

        //las meto en el comboBox
        ComboBox comboBox = SignCtr.getPrivKeys();
        comboBox.getItems().add("Clave Privada");
        comboBox.getItems()
                .add(this.utilidades.putPoints(this.RSA.getD().toString(this.radix).toUpperCase(), this.radix));
        comboBox.getItems().add("Claves Privadas Parejas");
        for (iterator = 0; iterator < PPK.length; iterator++) {
            comboBox.getItems().add(PPK[iterator]);
        }
        comboBox.setValue(
                this.utilidades.putPoints(this.RSA.getD().toString(this.radix).toUpperCase(), this.radix));
        comboBox.setVisibleRowCount(7);

        disableOnProgress(true);

        Scene scene = new Scene(root);
        secondStage.initModality(Modality.NONE);
        secondStage.getIcons()
                .add(new Image(GenRSAController.class.getResourceAsStream("/allImages/genRSA.png")));
        secondStage.setTitle("genRSA - Firma y Validacin");
        secondStage.setScene(scene);
        secondStage.show();

        secondStage.setOnCloseRequest(closeEvent -> {
            this.disableOnProgress(false);
            this.disableButtons();
        });

    } catch (IOException ex) {
        //no pongo mensaje de error, porque no se puede dar el caso
    }

}

From source file:com.github.drbookings.ui.controller.MainController.java

private void showSettingsICal() {
    try {/*from   www. j  a  va  2 s  . co  m*/
        final FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/ICalSettingsView.fxml"));
        final Parent root = loader.load();
        final Stage stage = new Stage();
        final Scene scene = new Scene(root);
        stage.setTitle("iCal Settings");
        stage.setScene(scene);
        stage.setWidth(600);
        stage.setHeight(400);
        stage.show();
    } catch (final IOException e) {
        logger.error(e.getLocalizedMessage(), e);
    }
}

From source file:genrsa.GenRSAController.java

/**
 * Muestra por pantalla la informacin relativa a genRSA 
 * @param event //from  www  .j a va  2  s  .  c  o  m
 */
public void aboutGenRSA(ActionEvent event) {
    Stage stage;
    FXMLLoader fxmlLoader;
    Parent root;

    try {
        stage = new Stage();
        fxmlLoader = new FXMLLoader(getClass().getResource("/About/About.fxml"));
        root = fxmlLoader.load();

        Scene scene = new Scene(root);
        stage.initModality(Modality.APPLICATION_MODAL);
        stage.initOwner(this.unitsD.getScene().getWindow());
        stage.setResizable(false);
        stage.getIcons().add(new Image(GenRSAController.class.getResourceAsStream("/allImages/genRSA.png")));
        stage.setTitle("Acerca de genRSA v2.1");
        stage.setScene(scene);
        stage.show();

    } catch (IOException ex) {
        //no pongo mensaje de error, porque no se puede dar el caso
    }

}

From source file:com.github.drbookings.ui.controller.MainController.java

private void showUpcomingEvents() {
    try {/*from   w ww.j  a  v a2 s.  c  o m*/
        final FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/UpcomingView.fxml"));
        final Parent root = loader.load();
        final Stage stage = new Stage();
        final Scene scene = new Scene(root);
        stage.setTitle("What's next");
        stage.setScene(scene);
        stage.setWidth(600);
        stage.setHeight(400);
        final Stage windowStage = (Stage) node.getScene().getWindow();
        stage.setX(windowStage.getX() + windowStage.getWidth() / 2 - stage.getWidth() / 2);
        stage.setY((windowStage.getY() + windowStage.getHeight()) / 2 - stage.getHeight() / 2);
        final UpcomingController c = loader.getController();
        c.setManager(getManager());
        stage.show();
    } catch (final IOException e) {
        logger.error(e.getLocalizedMessage(), e);
    }
}

From source file:snpviewer.SnpViewer.java

private void zoomRegion(Rectangle rectangle) {
    try {/*from w  w w .  java  2 s  . c  om*/
        FXMLLoader loader = new FXMLLoader(getClass().getResource("ZoomRegionView.fxml"));
        ChromosomeLength chromLength = new ChromosomeLength(genomeVersion);
        String currentChrom = (String) chromosomeBoxList[chromosomeSelector.getSelectionModel()
                .getSelectedIndex()];
        double startCoordinate = chromLength.getLength(currentChrom) / selectionOverlayPane.getWidth()
                * rectangle.getX();
        double selectionWidth = chromLength.getLength(currentChrom) / selectionOverlayPane.getWidth()
                * rectangle.getWidth();
        if (rectangle.getX() == 0) {
            startCoordinate = 1;
        }

        Pane page = (Pane) loader.load();
        Scene scene = new Scene(page);
        Stage stage = new Stage();
        stage.setScene(scene);
        stage.setTitle("chr" + currentChrom + ":" + nf.format(startCoordinate) + "-"
                + nf.format(startCoordinate + selectionWidth));
        scene.getStylesheets().add(SnpViewer.class.getResource("SnpViewerStyleSheet.css").toExternalForm());
        String subPath = "zoom";
        stage.initModality(Modality.NONE);
        stage.getIcons().add(new Image(this.getClass().getResourceAsStream("icon.png")));
        stage.show();
        ZoomRegionViewController zoomController = (ZoomRegionViewController) loader.getController();
        ArrayList<SnpFile> bothFiles = new ArrayList<>();
        bothFiles.addAll(affFiles);
        bothFiles.addAll(unFiles);
        ArrayList<Pane> zoomPanes = zoomController.setPanes(bothFiles);
        zoomController.setParentController(this);
        zoomController.setLoadingRectangle(rectangle);
        zoomController.setRegionLength(selectionWidth);
        zoomController.setRegionStart(startCoordinate);
        zoomController.setChromosome(currentChrom);
        SplitPane zoomSplit = zoomController.getSplitPane();
        Iterator<SnpFile> sIter = bothFiles.iterator();
        Iterator<Pane> pIter = zoomPanes.iterator();
        if (!sIter.hasNext() || !pIter.hasNext()) {
            return;
        }
        SnpFile firstFile = sIter.next();
        Pane firstPane = pIter.next();
        drawCoordinatesWithIterator(firstFile, firstPane, subPath, sIter, pIter, 1, bothFiles.size(),
                currentChrom, startCoordinate, startCoordinate + selectionWidth, true, zoomSplit);
        zoomController.tidyPanes();

    } catch (ChromosomeLength.ChromosomeLengthException | IOException ex) {
        Dialogs.showErrorDialog(null, "Please see details for stack trace.", "Error displaying zoomed region",
                "SnpViewer", ex);
    }
}

From source file:patientmanagerv1.HomeController.java

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

    //start with the forum and the common questions page, add-on the profile page and private messaging features

    //passLoaded = false;

    //sets the current Patient
    try {/*  ww w  .j a v a 2 s  . c om*/
        String entireFileText = new Scanner(new File(installationPath + "/currentpatient.txt"))
                .useDelimiter("//A").next();
        String[] nameArray = entireFileText.split(",");

        firstName = nameArray[0].toLowerCase();
        lastName = nameArray[1].toLowerCase();
        dob = nameArray[2];
    } catch (Exception e) {
    }

    //checks the signed status
    try {
        FileReader reader = new FileReader(
                installationPath + "/userdata/" + firstName + lastName + dob + "/EvaluationForm/signed.txt");
        //+ "/userdata/" + get.currentPatientFirstName + get.currentPatientLastName + "/EvaluationForm/first.txt");
        BufferedReader br = new BufferedReader(reader);
        String signedStatus = br.readLine();
        br.close();
        reader.close();

        if (signedStatus.equalsIgnoreCase("true")) {
            dccSigned = true;
        } else {
            dccSigned = false;
        }

        FileReader reader2 = new FileReader(installationPath + "/userdata/" + firstName + lastName + dob
                + "/EvaluationForm/assistantsigned.txt");
        //+ "/userdata/" + get.currentPatientFirstName + get.currentPatientLastName + "/EvaluationForm/first.txt");
        BufferedReader br2 = new BufferedReader(reader2);
        String assistantSigned = br2.readLine();
        br2.close();
        reader2.close();

        if (assistantSigned.equalsIgnoreCase("true")) {
            partnerSigned = true;
        } else {
            partnerSigned = false;
        }

        /*saveButton.setDisable(false);
        sign.setVisible(true);
        sign.setDisable(true);
        signature.setVisible(false);*/

        if (signedStatus.equalsIgnoreCase("false") && (assistantSigned.equalsIgnoreCase("false"))) {
            saveButton.setDisable(false);
            sign.setVisible(true);
            sign.setDisable(false);
            assistantsign.setVisible(true);
            assistantsign.setDisable(false);
            assistantsignature.setVisible(false);
            signature.setVisible(false);
            signature2.setVisible(false);
            ap.setDisable(false);
        } else if (signedStatus.equalsIgnoreCase("true") && (assistantSigned.equalsIgnoreCase("false"))) {
            saveButton.setDisable(true);
            sign.setVisible(false);
            assistantsign.setVisible(true);
            assistantsign.setDisable(false);
            assistantsignature.setVisible(false);
            signature.setVisible(true);
            signature2.setVisible(true);
            signature.setText("This document has been digitally signed by David Zhvikov MD");
            ap.setDisable(true);
        } else if (signedStatus.equalsIgnoreCase("false") && (assistantSigned.equalsIgnoreCase("true"))) {
            saveButton.setDisable(true);
            sign.setVisible(true);
            assistantsign.setVisible(false);
            assistantsign.setDisable(true);
            assistantsignature.setVisible(true);
            signature.setVisible(false);
            signature2.setVisible(false);
            signature.setText("This document has been digitally signed by David Zhvikov MD");
            ap.setDisable(true);
        } else {
            saveButton.setDisable(true);
            sign.setVisible(false);
            assistantsign.setVisible(false);
            assistantsign.setDisable(true);
            assistantsignature.setVisible(true);
            signature.setVisible(true);
            signature2.setVisible(true);
            signature.setText("This document has been digitally signed by David Zhvikov MD");
            ap.setDisable(true);
        }
    } catch (Exception e) {
    }

    //loads the ListView

    try {
        FileReader r2 = new FileReader(
                installationPath + "/userdata/" + firstName + lastName + dob + "/ProgressReports.txt");
        BufferedReader b2 = new BufferedReader(r2);

        String s;
        ArrayList progressNotes = new ArrayList();

        while ((s = b2.readLine()) != null) {
            //System.out.println(s);
            progressNotes.add(s);
        }

        b2.close();
        r2.close();

        //Adds the Progress Notes to the ListView

        ObservableList<String> items = FXCollections.observableArrayList("Single", "Double");
        items.clear();

        for (int counter = 0; counter < progressNotes.size(); counter++) {
            items.add(progressNotes.get(counter).toString());
        }

        listOfProgressReports.setItems(items);

        //String[] ethnicityArray = ethnicity.split(",");
    } catch (Exception e) {
        //System.out.println("file not found");
    }

    //initializes the evaluation form [with the new patient's name] for the current patient
    fillName();

    fillDOB();

    fillAge(loaded);

    fillGender();

    fillMaritalStatus();

    fillEthnicity();

    fillReferredBy();

    fillReasonForReferral();

    fillSourceOfInformation();

    fillReliabilityOfInformation();

    fillHistoryOfPresentIllness();

    fillSignsSymptoms();

    fillCurrentMedications();

    fillPastPsychiatricHistory();

    fillPastHistoryOf();

    fillHistoryOfMedicationTrialsInThePast();

    fillSubstanceUseHistory();

    fillDeniesHistoryOf();

    fillSocialHistory();

    fillParentsSiblingsChildren();

    fillFamilyHistoryOfMentalIllness();

    fillEducation();

    fillEmployment();

    fillLegalHistory();

    fillPastMedicalHistory();

    fillAllergies();

    fillAppearance();

    fillEyeContact();

    fillAttitude();

    fillMotorActivity();

    fillAffect();

    fillMood();

    fillSpeech();

    fillThoughtProcess();

    fillThoughtContent();

    fillPerception();

    fillSuicidality();

    fillHomicidality();

    fillOrientation();

    fillShortTermMemory();

    fillLongTermMemory();

    fillGeneralFundOfKnowledge();

    fillIntellect();

    fillAbstraction();

    fillJudgementAndInsight();

    fillClinicalNotes();

    fillTreatmentPlan();

    fillSideEffects();

    fillLabs();

    fillEnd();

    fillSignatureZone();

    //        currentPatientFirstName = get.currentPatientFirstName;
    //        currentPatientLastName = get.currentPatientLastName;

    //sets the current patient
    /*try
    {
    String entireFileText = new Scanner(new File(installationPath + "/Patients.txt")).useDelimiter("//A").next();
    String[] arrayOfNames = entireFileText.split(";");
            
            
    System.out.println("Patient Name: " + arrayOfNames[arrayOfNames.length - 1]);
            
    String nameWithComma = arrayOfNames[arrayOfNames.length - 1];
    String[] nameArray = nameWithComma.split(",");
            
    firstName = nameArray[0].toLowerCase();
    lastName = nameArray[1].toLowerCase();
            
            
            
    }
    catch(Exception e)
    {}*/

    /*ArrayList progressNotes = new ArrayList();
            
    for(int i = 0; i < listOfProgressReports.getItems().size(); i++)
    {
        progressNotes.add(listOfProgressReports.getItems().get(i));
    }*/

    //broken and betrayed
    //of the ecsts's you've shown me.
    //...for me, italicsmaster, she put emphasis/lingered on the word. "M"

    menu.getMenus().removeAll();
    Menu file = new Menu("File");
    Menu edit = new Menu("Edit");
    Menu view = new Menu("View");
    Menu help = new Menu("About");
    Menu speech = new Menu("Speech Options");

    MenuItem save = new MenuItem("Save");
    MenuItem print = new MenuItem("Print");
    MenuItem printWithSettings = new MenuItem("Print With Settings");
    MenuItem export = new MenuItem("Export to");
    MenuItem logout = new MenuItem("Return to Patient Selection");
    MenuItem deleteThisPatient = new MenuItem("Delete This Patient");
    MenuItem exit = new MenuItem("Exit");

    MenuItem undo = new MenuItem("Undo (ctrl+z)");
    MenuItem redo = new MenuItem("Redo (ctrl+y)");
    MenuItem selectAll = new MenuItem("Select All (ctrl+A)");
    MenuItem cut = new MenuItem("Cut (ctrl+x)");
    MenuItem copy = new MenuItem("Copy (ctrl+c)");
    MenuItem paste = new MenuItem("Paste (ctrl+v)");
    MenuItem enableBackdoorModifications = new MenuItem("Enable Modification of this Evaluation Post-Signing");

    Menu submenu1 = new Menu("Create");
    Menu submenu2 = new Menu("Load");
    Menu submenu3 = new Menu("New");
    MenuItem createProgressReport = new MenuItem("Progress Report");
    MenuItem loadProgressReport = new MenuItem("Progress Report");
    MenuItem deleteProgressReport = new MenuItem("Delete selected progress report");
    submenu1.getItems().add(submenu3);
    submenu3.getItems().add(createProgressReport);
    submenu2.getItems().add(loadProgressReport);

    MenuItem howToUse = new MenuItem("How to use patient manager");
    MenuItem versionInfo = new MenuItem("About Patient Manager/Version Info");

    /*MenuItem read = new MenuItem("Read to me");
    MenuItem launch = new MenuItem("Launch Dictation");*/
    //read to me menu, dictation menu- select a document to read aloud, read this passage aloud, launch windows in-built dictation, download brainac dictation online
    Menu read = new Menu("Read to me");
    Menu launch = new Menu("Dictation");

    Menu readPassageOrFormStartStop = new Menu("Read this passage/read this form");

    MenuItem startReading1 = new MenuItem("Start");
    MenuItem stopReading1 = new MenuItem("Stop");
    MenuItem startReading2 = new MenuItem("Start");
    MenuItem stopReading2 = new MenuItem("Stop");
    Menu readUploadedDocument = new Menu("Select a document to read");
    MenuItem launchWindowsDictation = new MenuItem("Launch Windows' Built-In Dictation");
    MenuItem launchBrainacDictation = new MenuItem("Download Brainac Dictation");

    startReading1.setDisable(true);
    stopReading1.setDisable(true);
    startReading2.setDisable(true);
    stopReading2.setDisable(true);

    readPassageOrFormStartStop.getItems().add(startReading1);
    readPassageOrFormStartStop.getItems().add(stopReading1);
    readUploadedDocument.getItems().add(startReading2);
    readUploadedDocument.getItems().add(stopReading2);

    readPassageOrFormStartStop.setDisable(true);
    readUploadedDocument.setDisable(true);

    launchBrainacDictation.setDisable(true);

    read.getItems().add(readPassageOrFormStartStop);
    read.getItems().add(readUploadedDocument);
    launch.getItems().add(launchWindowsDictation);
    launch.getItems().add(launchBrainacDictation);

    file.getItems().add(save);
    file.getItems().add(print);
    file.getItems().add(printWithSettings);
    file.getItems().add(export);
    file.getItems().add(logout);
    file.getItems().add(deleteThisPatient);
    file.getItems().add(exit);

    edit.getItems().add(undo);
    edit.getItems().add(redo);
    edit.getItems().add(selectAll);
    edit.getItems().add(cut);
    edit.getItems().add(copy);
    edit.getItems().add(paste);
    edit.getItems().add(enableBackdoorModifications);

    view.getItems().add(submenu1);
    view.getItems().add(submenu2);
    view.getItems().add(deleteProgressReport);

    help.getItems().add(howToUse);
    help.getItems().add(versionInfo);

    speech.getItems().add(read);
    speech.getItems().add(launch);

    menu.prefWidthProperty().bind(masterPane.widthProperty());
    //menu.setStyle("-fx-padding: 0 20 0 20;");

    //menu.getMenus().addAll(file, edit, view, help, speech);
    menu.getMenus().add(file);
    menu.getMenus().add(edit);
    menu.getMenus().add(view);
    menu.getMenus().add(speech);
    menu.getMenus().add(help);

    undo.setDisable(true);
    redo.setDisable(true);
    cut.setDisable(true);
    copy.setDisable(true);
    paste.setDisable(true);
    selectAll.setDisable(true);

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

        @Override
        public void handle(ActionEvent e) {

            int result = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this patient?",
                    "Warning", JOptionPane.OK_CANCEL_OPTION);

            if (result == 2) {

            }

            if (result == 0) {
                int result2 = JOptionPane.showConfirmDialog(null,
                        "Are you ABSOLUTELY sure you want to delete this patient?", "Warning",
                        JOptionPane.OK_CANCEL_OPTION);

                if (result2 == 2) {

                }
                if (result2 == 0) {
                    String patientToDelete = firstName + "," + lastName + "," + dob; //listOfProgressReports.getSelectionModel().getSelectedItem().toString();

                    //            String currRepNoColons = currRep.replace(":", "");
                    //        currRepNoColons = currRepNoColons.trim();

                    //1) removes the report from the list in the file
                    try {
                        FileReader r2 = new FileReader(installationPath + "/patients.txt");
                        BufferedReader b2 = new BufferedReader(r2);

                        String s = b2.readLine();
                        String[] patients = s.split(";"); //String[] ssArray = ss.split(",");

                        /*for(int i = 0; i < patients.size(); i++)
                        {
                                
                        }*/

                        /*while((s = b2.readLine()) != null)
                        {
                            //System.out.println(s);
                                
                            if(!s.equalsIgnoreCase(patientToDelete))
                            {patients.add(s);}
                        }*/

                        b2.close();
                        r2.close();

                        File fff = new File(installationPath + "/patients.txt");
                        FileWriter ddd = new FileWriter(fff, false);
                        BufferedWriter bw = new BufferedWriter(ddd);
                        ddd.append("");
                        bw.close();
                        ddd.close();

                        for (int i = 0; i < patients.length; i++) {
                            File openProgressReportsList = new File(installationPath + "/patients.txt");
                            FileWriter fw = new FileWriter(openProgressReportsList, true);
                            BufferedWriter bufferedwriter = new BufferedWriter(fw);
                            if (!(patients[i].equalsIgnoreCase(patientToDelete))) {
                                fw.append(patients[i].toLowerCase() + ";");
                            }
                            bufferedwriter.close();
                            fw.close();
                        }
                    } catch (Exception ex) {

                    }

                    /*try{
                            FileReader reader = new FileReader(installationPath + "/userdata/" + firstName + lastName + dob + "/ProgressReports.txt");
                            BufferedReader br = new BufferedReader(reader); 
                            String fileContents = br.readLine();
                            br.close();
                            reader.close();
                            
                            fileContents = fileContents.replace(currRep, "");
                            //System.out.println("fc:" + fileContents);
                            
                            //writes the new contents to the file:
                            //writes the new report to the list
                            File openProgressReportsList = new File(installationPath + "/userdata/" + firstName + lastName + dob + "/ProgressReports.txt");
                            FileWriter fw = new FileWriter(openProgressReportsList, false);           
                            BufferedWriter bufferedwriter = new BufferedWriter(fw);
                            fw.append(fileContents);
                            bufferedwriter.close();
                            fw.close();
                    }
                    catch(Exception e)
                    {
                            
                    }*/

                    //2) Deletes the folder for that progress report
                    try {
                        File directory = new File(installationPath + "/userdata/" + firstName + lastName + dob
                                + "/ProgressNotes");
                        File[] subdirs = directory.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY);
                        for (File dir : subdirs) {
                            File deleteThis = new File(installationPath + "/userdata/" + firstName + lastName
                                    + dob + "/ProgressNotes/" + dir.getName());
                            //System.out.println("Directory: " + dir.getName());
                            File[] filez = deleteThis.listFiles();

                            for (int i = 0; i < filez.length; i++) {
                                filez[i].delete();
                            }
                            //the wedding nightmare: red, red, dark purple-brown; big-ol red wrap/red jacket
                            deleteThis.delete();
                        }
                        File path3 = new File(installationPath + "/userdata/" + firstName + lastName + dob
                                + "/ProgressNotes");
                        File[] files3 = path3.listFiles();

                        for (int i = 0; i < files3.length; i++) {
                            files3[i].delete();
                        }
                        //the wedding nightmare: red, red, dark purple-brown; big-ol red wrap/red jacket
                        path3.delete();

                        File path2 = new File(installationPath + "/userdata/" + firstName + lastName + dob
                                + "/EvaluationForm");
                        File[] files2 = path2.listFiles();

                        for (int i = 0; i < files2.length; i++) {
                            files2[i].delete();
                        }
                        //the wedding nightmare: red, red, dark purple-brown; big-ol red wrap/red jacket
                        path2.delete();

                        File path = new File(installationPath + "/userdata/" + firstName + lastName + dob);
                        File[] files = path.listFiles();

                        for (int i = 0; i < files.length; i++) {
                            files[i].delete();
                        }
                        //the wedding nightmare: red, red, dark purple-brown; big-ol red wrap/red jacket
                        path.delete();
                        //deleteDirectory(installationPath + "/userdata/" + firstName + lastName + dob + "/ProgressNotes/" + currRepNoColons);
                        //Files.delete(installationPath + "/userdata/" + firstName + lastName + dob + "/ProgressNotes/" + currRepNoColons);

                        //PUT A MESSAGE SAYING "DELETED" HERE
                        JOptionPane.showMessageDialog(null, "Deleted!");

                        toPatientSelectionNoDialog.fire();
                    } catch (Exception exception) {
                    }
                }

            }

        }
    });

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

        @Override
        public void handle(ActionEvent e) {
            save();
        }
    });

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

        @Override
        public void handle(ActionEvent e) {
            JOptionPane.showMessageDialog(null, "Patient Manager Version 5.0.6 \n Compatible with: Windows 7");
        }
    });

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

        @Override
        public void handle(ActionEvent e) {
            JOptionPane.showMessageDialog(null,
                    "Help: \n\n\n Print- sends the document to the default printer. Requires no passwords. \n\n Print with Settings- opens the evaluation or progress report in word so that the document can be printed using word's built-in dialog. Because the word document will be open to modification, 'print with settings' requires the physician's password. \n\n Export to- save an evaluation or progress note to the location of your choice, rather than to the default location. Requires the physician/admin's password. \n\n Enable Backdoor Modifications- allows the physician or physician's assistant(s) to reopen the forms for modification post-signing. If the physician's password is used, only his signature will become undone. If the physician's assistant(s)' password is used, both the physician's signature (if relevant) and the assitant's signature will become undone (since the physician will need to review the new modifications before re-signing his approval). \n\n Create/Load/Delete a progress note- the create & load functions are accessible directly from the interface. Deletion can only be accessed from the drop-down menu. Select a progress report prior to clicking 'load' or 'delete' \n\n Speech Options- most speech options are still a WIP, HOWEVER, you can click 'launch windows 7 native dictation' from either the interface OR the menu bar, in order to quickly access Windows' built-in dictation capabilities. \n\n Version info can be found in 'About' in the 'Help' drop-down menu on the main menu bar.");
        }
    });

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

        @Override
        public void handle(ActionEvent e) {
            launchSpeechRecognition();
        }
    });

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

        @Override
        public void handle(ActionEvent e) {
            int result = JOptionPane.showConfirmDialog(null,
                    "Do you want to save any unsaved changes before exiting?", "Save changes?",
                    JOptionPane.YES_NO_CANCEL_OPTION);

            if (result == 0) {
                saveEval();

                //some idiocy goes here
                /*try
                {
                    Audio audio = Audio.getInstance();
                    InputStream sound = audio.getAudio("Have a nice day!", Language.ENGLISH);
                    audio.play(sound);
                }
                catch(Exception excep)
                {System.out.println(excep);}*/

                System.exit(0);
            }
            if (result == 1) {
                //some idiocy goes here
                /*try
                {
                    Audio audio = Audio.getInstance();
                    InputStream sound = audio.getAudio("Have a nice day!", Language.ENGLISH);
                    audio.play(sound);
                }
                catch(Exception excep)
                {System.out.println(excep);}*/

                System.exit(0);
            }
            if (result == 2) {

            }

        }
    });

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

        @Override
        public void handle(ActionEvent e) {
            enableBackdoorModifications();
        }
    });

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

        @Override
        public void handle(ActionEvent e) {
            deleteProgressReport();
        }
    });

    //<MenuItem fx:id="loadProgressReport" onAction="#loadProgressReport" />

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

        @Override
        public void handle(ActionEvent e) {
            load.fire();
        }
    });

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

        @Override
        public void handle(ActionEvent e) {
            createPN.fire();
        }
    }); //read to me menu, dictation menu- select a document to read aloud, read this passage aloud, launch windows in-built dictation, download brainac dictation online

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

        @Override
        public void handle(ActionEvent e) {
            final Stage dialog = new Stage();
            dialog.initModality(Modality.APPLICATION_MODAL);

            final TextField textField = new TextField();
            Button submit = new Button();
            Button cancel = new Button();
            final Label label = new Label();

            cancel.setText("Cancel");
            cancel.setAlignment(Pos.CENTER);
            submit.setText("Submit");
            submit.setAlignment(Pos.BOTTOM_RIGHT);

            final VBox dialogVbox = new VBox(20);
            dialogVbox.getChildren().add(new Text("Enter the master password: "));
            dialogVbox.getChildren().add(textField);
            dialogVbox.getChildren().add(submit);
            dialogVbox.getChildren().add(cancel);
            dialogVbox.getChildren().add(label);

            Scene dialogScene = new Scene(dialogVbox, 300, 200);
            dialog.setScene(dialogScene);
            dialog.setTitle("Security/Physician Authentication");
            dialog.show();

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

                public void handle(ActionEvent anEvent) {
                    String password = textField.getText();

                    if (password.equalsIgnoreCase("protooncogene")) {
                        dialog.close();

                        export();

                    } else {
                        label.setText("The password you entered is incorrect. Please try again.");
                    }

                }
            });

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

                public void handle(ActionEvent anEvent) {
                    dialog.close();
                    //close the window here
                }
            });

        }
    });

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

        @Override
        public void handle(ActionEvent e) {
            print();
        }
    });
    printWithSettings.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent e) {
            printAdv();
        }
    });
    logout.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent e) {
            toPatientSelection.fire();
        }
    });

    ///"sometime during s-y lol."

}

From source file:snpviewer.SnpViewer.java

public void showSavedRegionsTable() {
    if (savedRegions.size() > 0) {
        FXMLLoader tableLoader = new FXMLLoader(getClass().getResource("MultiRegionReporter.fxml"));
        try {/*from   ww w .  ja  v a2  s.c o  m*/
            Pane tablePane = (Pane) tableLoader.load();
            MultiRegionReporterController multiReg = (MultiRegionReporterController) tableLoader
                    .getController();
            Scene tableScene = new Scene(tablePane);
            Stage tableStage = new Stage();
            tableStage.setScene(tableScene);
            tableScene.getStylesheets()
                    .add(SnpViewer.class.getResource("SnpViewerStyleSheet.css").toExternalForm());
            tableStage.getIcons().add(new Image(this.getClass().getResourceAsStream("icon.png")));
            multiReg.displayData(savedRegions);
            tableStage.setTitle("Saved Regions");
            tableStage.initModality(Modality.NONE);

            tableStage.show();
        } catch (Exception ex) {
            Dialogs.showErrorDialog(null, "Error displaying" + " Saved Regions - see Details for stack trace.",
                    "Saved Regions Display Error!", "SnpViewer", ex);
        }
    } else {
        Dialogs.showInformationDialog(null, "No regions " + "found.", "Saved Regions", "SnpViewer");
    }
}