Example usage for javafx.scene.text Text Text

List of usage examples for javafx.scene.text Text Text

Introduction

In this page you can find the example usage for javafx.scene.text Text Text.

Prototype

public Text(String text) 

Source Link

Document

Creates an instance of Text containing the given string.

Usage

From source file:FeeBooster.java

private GridPane unsignedTxGrid(Transaction tx) {
    // Setup Grid
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);//from  w w w.j a  v  a 2s.c om
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    // Instructions Text
    Text instructions = new Text("Below is the unsiged version of the fee boosted transaction. You can sign "
            + "this here or copy this transaction and sign it in your wallet");
    grid.add(instructions, 0, 0);

    // Put unsigned transaction in text area
    byte[] unsignedTxBytes = Transaction.serialize(tx, true);
    TextArea unsignedTxTxt = new TextArea(Utils.bytesToHex(unsignedTxBytes));
    unsignedTxTxt.setWrapText(true);
    grid.add(unsignedTxTxt, 0, 1);

    // Radio buttons for sign here or sign elsewhere
    /*VBox signRadioVbox = new VBox();
    ToggleGroup signRadioGroup = new ToggleGroup();
    RadioButton signHereRadio = new RadioButton("Sign Here");
    signHereRadio.setToggleGroup(signRadioGroup);
    signRadioVbox.getChildren().add(signHereRadio);
    RadioButton signWalletRadio = new RadioButton("Sign in my wallet");
    signWalletRadio.setToggleGroup(signRadioGroup);
    signWalletRadio.setSelected(true);
    signRadioVbox.getChildren().add(signWalletRadio);
    grid.add(signRadioVbox, 0, 3); */

    // Add Next Button
    Button nextBtn = new Button("Next");
    nextBtn.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            //if(signHereRadio.isSelected())
            //    stage.setScene(new Scene(signTxGrid(tx), 800, 500));
            //else if(signWalletRadio.isSelected())
            if (sceneCursor == scenes.size() - 1) {
                Scene scene = new Scene(broadcastTxGrid(tx), 900, 500);
                scenes.add(scene);
                sceneCursor++;
                stage.setScene(scene);
            } else {
                sceneCursor++;
                stage.setScene(scenes.get(sceneCursor));
            }
        }
    });
    HBox btnHbox = new HBox(10);

    // Back Button
    Button backBtn = new Button("Back");
    backBtn.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            sceneCursor--;
            stage.setScene(scenes.get(sceneCursor));
        }
    });
    btnHbox.getChildren().add(backBtn);
    btnHbox.getChildren().add(nextBtn);

    // Cancel Button
    Button cancelBtn = new Button("Cancel");
    cancelBtn.setOnAction(cancelEvent);
    btnHbox.getChildren().add(cancelBtn);
    grid.add(btnHbox, 0, 2);

    return grid;
}

From source file:de.pixida.logtest.designer.testrun.TestRunEditor.java

private void insertConfigItemsIntoGrid(final GridPane gp, final List<Triple<String, Node, String>> formItems) {
    for (int i = 0; i < formItems.size(); i++) {
        final String title = formItems.get(i).getLeft();
        final Node inputElement = formItems.get(i).getMiddle();
        final String description = formItems.get(i).getRight();

        // Put text flow object into cell. If a Text instance is used only, it will grab the whole cell size and center the text
        // (horizontally and vertically). Therefore, the table cell alignment does not work.
        final TextFlow titleText = new TextFlow(new Text(title));
        titleText.setStyle("-fx-font-weight: bold;");
        final TextFlow fieldName = new TextFlow(titleText);
        fieldName.autosize();/*w w  w . j  a  v a2 s  .c o m*/
        fieldName.setMinWidth(fieldName.getWidth());
        gp.add(fieldName, 0, i);
        final VBox vbox = new VBox(inputElement);
        if (StringUtils.isNotBlank(description)) {
            vbox.getChildren().add(new TextFlow(new Text(description)));
        }
        gp.add(vbox, 1, i);
    }
}

From source file:de.pixida.logtest.designer.logreader.LogReaderEditor.java

private void insertConfigItemsIntoGrid(final GridPane gp, final List<Triple<String, Node, String>> formItems) {
    for (int i = 0; i < formItems.size(); i++) {
        final String title = formItems.get(i).getLeft();
        final Node inputElement = formItems.get(i).getMiddle();
        final String description = formItems.get(i).getRight();

        // Put text flow object into cell. If a Text instance is used only, it will grab the whole cell size and center the text
        // (horizontally and vertically). Therefore, the table cell alignment does not work.
        final TextFlow titleText = new TextFlow(new Text(title));
        titleText.setStyle("-fx-font-weight: bold;");
        final TextFlow fieldName = new TextFlow(titleText);
        fieldName.autosize();// w  ww .  j a  v  a 2  s  .c  om
        fieldName.setMinWidth(fieldName.getWidth());
        gp.add(fieldName, 0, i);
        final Text descriptionText = new Text(description);
        final VBox vbox = new VBox(inputElement, new TextFlow(descriptionText));
        gp.add(vbox, 1, i);
    }
}

From source file:FeeBooster.java

private GridPane signTxGrid(Transaction tx) {
    // Setup Grid
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);//from  w  ww  .  j a v a2  s  . c  o m
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    // Instructions Text
    Text instructions = new Text(
            "Enter your Wallet Import Format private keys into the space below, one on each line.");
    grid.add(instructions, 0, 0);

    // Put private keys in text area
    TextArea unsignedTxTxt = new TextArea();
    unsignedTxTxt.setWrapText(true);
    grid.add(unsignedTxTxt, 0, 1);

    return grid;
}

From source file:FeeBooster.java

private GridPane broadcastTxGrid(Transaction tx) {
    // Setup Grid
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);/*from  ww  w. ja  v a  2  s .co m*/
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    // Instructions Text
    Text instructions = new Text("Enter your signed transaction into the space below.");
    grid.add(instructions, 0, 0);

    // Put signed transaction in text area
    TextArea signedTxTxt = new TextArea();
    signedTxTxt.setWrapText(true);
    grid.add(signedTxTxt, 0, 1);

    // Display some info about Transaction after sent
    Text txInfo = new Text();
    grid.add(txInfo, 0, 4);

    // Add Next Button
    Button nextBtn = new Button("Send Transaction");
    nextBtn.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            Transaction signedTx = new Transaction();
            Transaction.deserializeStr(signedTxTxt.getText(), signedTx);
            txInfo.setText("Transaction being broadcast. TXID: " + signedTx.getHash()
                    + "\nPlease wait a few minutes for best results, but you may now exit.");
            Broadcaster.broadcastTransaction(Transaction.serialize(signedTx, false));
        }
    });
    HBox btnHbox = new HBox(10);

    // Back Button
    Button backBtn = new Button("Back");
    backBtn.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            sceneCursor--;
            stage.setScene(scenes.get(sceneCursor));
        }
    });
    btnHbox.getChildren().add(backBtn);
    btnHbox.getChildren().add(nextBtn);

    // Cancel Button
    Button cancelBtn = new Button("Exit");
    cancelBtn.setOnAction(cancelEvent);
    btnHbox.getChildren().add(cancelBtn);
    grid.add(btnHbox, 0, 2);

    return grid;
}

From source file:Main.java

private TitledPane getShowBoundsControls() {
    ChangeListener<Boolean> cl = new ChangeListener<Boolean>() {
        @Override//from w  ww  .  j a va  2s  .  co  m
        public void changed(ObservableValue<? extends Boolean> observableValue, Boolean oldValue,
                Boolean newValue) {
            relayout();
        }
    };

    ChangeListener<Boolean> cl2 = new ChangeListener<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> observableValue, Boolean oldValue,
                Boolean newValue) {
            animate();
        }
    };

    layoutCbx.selectedProperty().addListener(cl);
    localCbx.selectedProperty().addListener(cl);
    parentCbx.selectedProperty().addListener(cl);
    effectGroup.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
        public void changed(ObservableValue<? extends Toggle> ov, Toggle old_toggle, Toggle new_toggle) {
            relayout();
        }
    });

    layoutAnimateCbx.selectedProperty().addListener(cl2);
    localAnimateCbx.selectedProperty().addListener(cl2);
    parentAnimateCbx.selectedProperty().addListener(cl2);

    double w = 20.0;
    double h = 10.0;

    Rectangle rLayout = new Rectangle(w, h);
    rLayout.setFill(LAYOUT_BOUNDS_RECT_FILL_COLOR);
    rLayout.setStrokeWidth(BOUNDS_STROKE_WIDTH);
    rLayout.setStroke(LAYOUT_BOUNDS_RECT_STROKE_COLOR);

    Rectangle rLocal = new Rectangle(w, h);
    rLocal.setFill(LOCAL_BOUNDS_RECT_FILL_COLOR);
    rLocal.setStrokeWidth(BOUNDS_STROKE_WIDTH);
    rLocal.setStroke(LOCAL_BOUNDS_RECT_STROKE_COLOR);

    Rectangle rParent = new Rectangle(w, h);
    rParent.setFill(PARENT_BOUNDS_RECT_FILL_COLOR);
    rParent.setStrokeWidth(BOUNDS_STROKE_WIDTH);
    rParent.setStroke(PARENT_BOUNDS_RECT_STROKE_COLOR);

    GridPane gp = new GridPane();
    gp.addRow(1, rLayout, new Text("Layout Bounds:"), layoutCbx, layoutAnimateCbx);
    gp.addRow(2, rLocal, new Text("Local Bounds:"), localCbx, localAnimateCbx);
    gp.addRow(3, rParent, new Text("Parent Bounds:"), parentCbx, parentAnimateCbx);

    TitledPane titledPane = new TitledPane("Show Bounds", gp);

    return titledPane;
}

From source file:qupath.lib.gui.tma.TMASummaryViewer.java

private Pane getCustomizeTablePane() {
    TableView<TreeTableColumn<TMAEntry, ?>> tableColumns = new TableView<>();
    tableColumns.setPlaceholder(new Text("No columns available"));
    tableColumns.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    tableColumns.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    SortedList<TreeTableColumn<TMAEntry, ?>> sortedColumns = new SortedList<>(
            table.getColumns().filtered(p -> !p.getText().trim().isEmpty()));
    sortedColumns.setComparator((c1, c2) -> c1.getText().compareTo(c2.getText()));
    tableColumns.setItems(sortedColumns);
    sortedColumns.comparatorProperty().bind(tableColumns.comparatorProperty());
    //      sortedColumns.comparatorProperty().bind(tableColumns.comparatorProperty());

    TableColumn<TreeTableColumn<TMAEntry, ?>, String> columnName = new TableColumn<>("Column");
    columnName.setCellValueFactory(v -> v.getValue().textProperty());
    TableColumn<TreeTableColumn<TMAEntry, ?>, Boolean> columnVisible = new TableColumn<>("Visible");
    columnVisible.setCellValueFactory(v -> v.getValue().visibleProperty());
    //      columnVisible.setCellValueFactory(col -> {
    //         SimpleBooleanProperty prop = new SimpleBooleanProperty(col.getValue().isVisible());
    //         prop.addListener((v, o, n) -> col.getValue().setVisible(n));
    //         return prop;
    //      });//from   ww w  . jav a  2s .c om
    tableColumns.setEditable(true);
    columnVisible.setCellFactory(v -> new CheckBoxTableCell<>());
    tableColumns.getColumns().add(columnName);
    tableColumns.getColumns().add(columnVisible);
    ContextMenu contextMenu = new ContextMenu();

    Action actionShowSelected = new Action("Show selected", e -> {
        for (TreeTableColumn<?, ?> col : tableColumns.getSelectionModel().getSelectedItems()) {
            if (col != null)
                col.setVisible(true);
            else {
                // Not sure why this happens...?
                logger.trace("Selected column is null!");
            }
        }
    });

    Action actionHideSelected = new Action("Hide selected", e -> {
        for (TreeTableColumn<?, ?> col : tableColumns.getSelectionModel().getSelectedItems()) {
            if (col != null)
                col.setVisible(false);
            else {
                // Not sure why this happens...?
                logger.trace("Selected column is null!");
            }
        }
    });

    contextMenu.getItems().addAll(ActionUtils.createMenuItem(actionShowSelected),
            ActionUtils.createMenuItem(actionHideSelected));
    tableColumns.setContextMenu(contextMenu);
    tableColumns.setTooltip(
            new Tooltip("Show or hide table columns - right-click to change multiple columns at once"));

    BorderPane paneColumns = new BorderPane(tableColumns);
    paneColumns.setBottom(PanelToolsFX.createColumnGridControls(ActionUtils.createButton(actionShowSelected),
            ActionUtils.createButton(actionHideSelected)));

    VBox paneRows = new VBox();

    // Create a box to filter on some metadata text
    ComboBox<String> comboMetadata = new ComboBox<>();
    comboMetadata.setItems(metadataNames);
    comboMetadata.getSelectionModel().getSelectedItem();
    comboMetadata.setPromptText("Select column");
    TextField tfFilter = new TextField();
    CheckBox cbExact = new CheckBox("Exact");
    // Set listeners
    cbExact.selectedProperty().addListener(
            (v, o, n) -> setMetadataTextPredicate(comboMetadata.getSelectionModel().getSelectedItem(),
                    tfFilter.getText(), cbExact.isSelected(), !cbExact.isSelected()));
    tfFilter.textProperty().addListener(
            (v, o, n) -> setMetadataTextPredicate(comboMetadata.getSelectionModel().getSelectedItem(),
                    tfFilter.getText(), cbExact.isSelected(), !cbExact.isSelected()));
    comboMetadata.getSelectionModel().selectedItemProperty().addListener(
            (v, o, n) -> setMetadataTextPredicate(comboMetadata.getSelectionModel().getSelectedItem(),
                    tfFilter.getText(), cbExact.isSelected(), !cbExact.isSelected()));

    GridPane paneMetadata = new GridPane();
    paneMetadata.add(comboMetadata, 0, 0);
    paneMetadata.add(tfFilter, 1, 0);
    paneMetadata.add(cbExact, 2, 0);
    paneMetadata.setPadding(new Insets(10, 10, 10, 10));
    paneMetadata.setVgap(2);
    paneMetadata.setHgap(5);
    comboMetadata.setMaxWidth(Double.MAX_VALUE);
    GridPane.setHgrow(tfFilter, Priority.ALWAYS);
    GridPane.setFillWidth(comboMetadata, Boolean.TRUE);
    GridPane.setFillWidth(tfFilter, Boolean.TRUE);

    TitledPane tpMetadata = new TitledPane("Metadata filter", paneMetadata);
    tpMetadata.setExpanded(false);
    //      tpMetadata.setCollapsible(false);
    Tooltip tooltipMetadata = new Tooltip(
            "Enter text to filter entries according to a selected metadata column");
    Tooltip.install(paneMetadata, tooltipMetadata);
    tpMetadata.setTooltip(tooltipMetadata);
    paneRows.getChildren().add(tpMetadata);

    // Add measurement predicate
    TextField tfCommand = new TextField();
    tfCommand.setTooltip(new Tooltip("Predicate used to filter entries for inclusion"));

    TextFields.bindAutoCompletion(tfCommand, e -> {
        int ind = tfCommand.getText().lastIndexOf("\"");
        if (ind < 0)
            return Collections.emptyList();
        String part = tfCommand.getText().substring(ind + 1);
        return measurementNames.stream().filter(n -> n.startsWith(part)).map(n -> "\"" + n + "\" ")
                .collect(Collectors.toList());
    });

    String instructions = "Enter a predicate to filter entries.\n"
            + "Only entries passing the test will be included in any results.\n"
            + "Examples of predicates include:\n" + "    \"Num Tumor\" > 200\n"
            + "    \"Num Tumor\" > 100 && \"Num Stroma\" < 1000";
    //      labelInstructions.setTooltip(new Tooltip("Note: measurement names must be in \"inverted commands\" and\n" + 
    //            "&& indicates 'and', while || indicates 'or'."));

    BorderPane paneMeasurementFilter = new BorderPane(tfCommand);
    Label label = new Label("Predicate: ");
    label.setAlignment(Pos.CENTER);
    label.setMaxHeight(Double.MAX_VALUE);
    paneMeasurementFilter.setLeft(label);

    Button btnApply = new Button("Apply");
    btnApply.setOnAction(e -> {
        TablePredicate predicateNew = new TablePredicate(tfCommand.getText());
        if (predicateNew.isValid()) {
            predicateMeasurements.set(predicateNew);
        } else {
            DisplayHelpers.showErrorMessage("Invalid predicate",
                    "Current predicate '" + tfCommand.getText() + "' is invalid!");
        }
        e.consume();
    });
    TitledPane tpMeasurementFilter = new TitledPane("Measurement filter", paneMeasurementFilter);
    tpMeasurementFilter.setExpanded(false);
    Tooltip tooltipInstructions = new Tooltip(instructions);
    tpMeasurementFilter.setTooltip(tooltipInstructions);
    Tooltip.install(paneMeasurementFilter, tooltipInstructions);
    paneMeasurementFilter.setRight(btnApply);

    paneRows.getChildren().add(tpMeasurementFilter);

    logger.info("Predicate set to: {}", predicateMeasurements.get());

    VBox pane = new VBox();
    //      TitledPane tpColumns = new TitledPane("Select column", paneColumns);
    //      tpColumns.setMaxHeight(Double.MAX_VALUE);
    //      tpColumns.setCollapsible(false);
    pane.getChildren().addAll(paneColumns, new Separator(), paneRows);
    VBox.setVgrow(paneColumns, Priority.ALWAYS);

    return pane;
}

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 {//  w  w w. j a v  a2  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:com.github.vatbub.tictactoe.view.Main.java

private double computeTextWidth(Font font, String text) {
    Text sampleText = new Text(text);
    sampleText.setFont(font);//w  w w .j  a v a  2s  . co  m
    return sampleText.getLayoutBounds().getWidth();
}

From source file:UI.MainStageController.java

@FXML
/**//from w  w w.ja  va2 s .  c o  m
 *
 * Shows information about the software.
 */
private void showAboutAlert() {
    Hyperlink hyperlink = new Hyperlink();
    hyperlink.setText("https://github.com/jmueller95/CORNETTO");
    Text text = new Text("Cornetto is a modern tool to visualize and calculate correlations between"
            + "samples.\nIt was created in 2017 by students of the group of Professor Huson in Tbingen.\nThe group"
            + "was supervised by Caner Bagci.\n\n" + "This project is licensed under the MIT License.\n\n"
            + "For more information go to: ");

    TextFlow textFlow = new TextFlow(text, hyperlink);

    text.setWrappingWidth(500);
    aboutAlert = new Alert(Alert.AlertType.INFORMATION);
    aboutAlert.setTitle("About " + GlobalConstants.NAME_OF_PROGRAM);
    aboutAlert.setHeaderText("What is " + GlobalConstants.NAME_OF_PROGRAM);
    aboutAlert.getDialogPane().setContent(textFlow);
    aboutAlert.show();
}