Example usage for javafx.scene.control TextArea TextArea

List of usage examples for javafx.scene.control TextArea TextArea

Introduction

In this page you can find the example usage for javafx.scene.control TextArea TextArea.

Prototype

public TextArea(String text) 

Source Link

Document

Creates a TextArea with initial text content.

Usage

From source file:de.pixida.logtest.designer.automaton.AutomatonNode.java

public void createEnterAndLeaveScriptConfig(final ConfigFrame cf) {
    final int scriptInputLines = 3;
    final TextArea onEnterScriptInput = new TextArea(this.onEnter);
    onEnterScriptInput.setStyle("-fx-font-family: monospace");
    onEnterScriptInput.setPrefRowCount(scriptInputLines);
    onEnterScriptInput.setWrapText(false);
    onEnterScriptInput.textProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> {
        this.setOnEnter(newValue);
        this.getGraph().handleChange();
    });//from ww  w. j  ava  2s .c om
    cf.addOption("When entering state, run script", onEnterScriptInput);

    final TextArea onLeaveScriptInput = new TextArea(this.onLeave);
    onLeaveScriptInput.setStyle("-fx-font-family: monospace");
    onLeaveScriptInput.setPrefRowCount(scriptInputLines);
    onLeaveScriptInput.setWrapText(false);
    onLeaveScriptInput.textProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> {
        this.setOnLeave(newValue);
        this.getGraph().handleChange();
    });
    cf.addOption("When leaving state, run script", onLeaveScriptInput);
}

From source file:uk.co.everywheremusic.viewcontroller.SetupScene.java

private boolean validateForm() {

    boolean valid = true;
    String errorMessage = "";

    File musicDir = new File(txtFolder.getText());
    if (!musicDir.isDirectory()) {
        valid = false;//  w w w. j  av a  2s. c  o m
        errorMessage += Globals.SETUP_ERR_INVALID_FOLDER + "\n\n";
    }

    String password = txtPassword.getText();
    String confirmPassword = txtConfirmPassword.getText();
    if (!password.equals(confirmPassword)) {
        valid = false;
        errorMessage += "Passwords do not match\n\n";
    }

    if (password.equals("")) {
        valid = false;
        errorMessage += "Enter a password\n\n";
    }

    if (!valid) {
        Alert alert = new Alert(AlertType.INFORMATION);
        alert.setTitle(Globals.SETUP_ALERT_TITLE);
        alert.setHeaderText(Globals.SETUP_ALERT_HEADER_TEXT);

        TextArea text = new TextArea(errorMessage);
        text.setEditable(false);
        text.setWrapText(true);
        GridPane.setVgrow(text, Priority.NEVER);
        GridPane.setHgrow(text, Priority.NEVER);

        GridPane content = new GridPane();
        content.setMaxWidth(Double.MAX_VALUE);
        content.add(text, 0, 0);

        alert.getDialogPane().setContent(content);
        alert.showAndWait();
    }

    return valid;

}

From source file:net.sourceforge.pmd.util.fxdesigner.MainDesignerController.java

private void showLicensePopup() {
    Alert licenseAlert = new Alert(AlertType.INFORMATION);
    licenseAlert.setWidth(500);//ww  w .j av  a 2 s  . c o m
    licenseAlert.setHeaderText("License");

    ScrollPane scroll = new ScrollPane();
    try {
        scroll.setContent(new TextArea(IOUtils.toString(getClass().getResourceAsStream("LICENSE"))));
    } catch (IOException e) {
        e.printStackTrace();
    }

    licenseAlert.getDialogPane().setContent(scroll);
    licenseAlert.showAndWait();
}

From source file:de.pixida.logtest.designer.automaton.AutomatonNode.java

protected void createTextAreaInput(final int numLines, final ConfigFrame cf, final String propertyName,
        final String initialValue, final Consumer<String> applyValue) {
    final TextArea inputField = new TextArea(initialValue);
    inputField.setPrefRowCount(numLines);
    inputField.setWrapText(true);/*from  ww w  .  ja  v  a 2 s  .c  o m*/
    inputField.textProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> {
        applyValue.accept(newValue);
        this.getGraph().handleChange();
    });
    cf.addOption(propertyName, inputField);
}

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

@FXML
void onTableClicked(MouseEvent event) {
    if (event.getClickCount() != 2)
        return;/*from www. jav a2  s  .co m*/
    TableView tableView = ((TableView) event.getSource());
    TableView.TableViewFocusModel focusModel = (TableView.TableViewFocusModel) tableView.focusModelProperty()
            .getValue();
    TablePosition position = focusModel.getFocusedCell();
    if (position.getTableColumn() == null)
        return;
    ObservableValue value = position.getTableColumn().getCellObservableValue(position.getRow());
    String valueStr = value.getValue().toString();
    Alert alert = new Alert(Alert.AlertType.INFORMATION);
    alert.setHeaderText(String.format("Value at ID:%d  %s",
            ((LIMSData) tableView.getItems().get(position.getRow())).getId(),
            position.getTableColumn().getText()));
    if (valueStr.length() > 300)
        alert.setContentText(valueStr.substring(0, 300) + "...");
    else
        alert.setContentText(valueStr);

    TextArea textArea = new TextArea(valueStr);
    textArea.setEditable(false);
    alert.getDialogPane().setExpandableContent(textArea);

    event.consume();
    alert.show();
}

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

private void addSpecialRequestNote(final Pane content, final BookingBean be) {
    final VBox b = new VBox();
    b.getChildren().add(new Text("Special Requests"));
    final TextArea ta0 = new TextArea(be.getSpecialRequestNote());
    ta0.setWrapText(true);/*from   w w  w  .j a va  2 s . c  om*/
    ta0.setPrefHeight(80);
    b.getChildren().add(ta0);
    booking2SpecialRequestNote.put(be, ta0);
    content.getChildren().add(b);

}

From source file:de.pixida.logtest.designer.automaton.AutomatonEdge.java

protected void createTextAreaInput(final int numLines, final ConfigFrame cf, final String propertyName,
        final String initialValue, final Consumer<String> applyValue, final Monospace monospace) {
    final TextArea inputField = new TextArea(initialValue);
    this.setMonospaceIfDesired(monospace, inputField);
    inputField.setPrefRowCount(numLines);
    inputField.setWrapText(true);//from ww  w .  ja  v a2s .  co m
    inputField.textProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> {
        applyValue.accept(newValue);
        this.getGraph().handleChange();
    });
    cf.addOption(propertyName, inputField);
}

From source file:FeeBooster.java

private GridPane unsignedTxGrid(Transaction tx) {
    // Setup Grid
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);//from  w  ww.  j a  v  a2s .c o m
    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:frontend.GUIController.java

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

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

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

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

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

    alert.showAndWait();

}

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

public void actionFileMerge() {
    FileChooser chooser = new FileChooser();
    chooser.setTitle("Merge Schema");
    if (schemaFile != null)
        chooser.setInitialDirectory(schemaFile.getParentFile());

    File file = chooser.showOpenDialog(stage);
    if (file == null)
        return;/*from  w w w .  j  ava  2 s.  co m*/

    Schema addSchema = null;
    try {
        addSchema = ModelSchema.deserialise(file);
    } catch (IOException ex) {
        ex.printStackTrace();
        Util.informWarning("Merge", "Failed to parse file: is it a valid schema?");
        return;
    }

    List<String> log = new ArrayList<>();
    Schema merged = SchemaUtil.mergeSchema(stack.getSchema(), addSchema, log);
    if (log.size() == 0) {
        Util.informMessage("Merge", "The merge file is the same: no action.");
        return;
    }

    String text = String.join("\n", log);
    Dialog<Boolean> confirm = new Dialog<>();
    confirm.setTitle("Confirm Merge Modifications");

    TextArea area = new TextArea(text);
    area.setWrapText(true);
    area.setPrefWidth(700);
    area.setPrefHeight(500);
    confirm.getDialogPane().setContent(area);

    ButtonType btnApply = new ButtonType("Apply", ButtonBar.ButtonData.OK_DONE);
    confirm.getDialogPane().getButtonTypes().addAll(new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE),
            btnApply);
    confirm.setResultConverter(buttonType -> {
        if (buttonType == btnApply)
            return true;
        return null;
    });

    Optional<Boolean> result = confirm.showAndWait();
    if (!result.isPresent() || result.get() != true)
        return;

    stack.changeSchema(merged, true);
    rebuildTree();
}