Example usage for javafx.scene.control TextArea setWrapText

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

Introduction

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

Prototype

public final void setWrapText(boolean value) 

Source Link

Usage

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);
    ta0.setPrefHeight(80);/*from   w w w  .  jav  a  2  s  .c om*/
    b.getChildren().add(ta0);
    booking2SpecialRequestNote.put(be, ta0);
    content.getChildren().add(b);

}

From source file:FeeBooster.java

private GridPane signTxGrid(Transaction tx) {
    // Setup Grid
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);//from   w w  w .  j  ava 2s .c  om
    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  .  jav 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:FeeBooster.java

private GridPane unsignedTxGrid(Transaction tx) {
    // Setup Grid
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);/*from ww  w.j  a  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("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:FeeBooster.java

@Override
public void start(Stage primaryStage) throws Exception {

    // Setup the stage
    stage = primaryStage;//from w ww.  j a v a  2  s.  c o m
    primaryStage.setTitle("Bitcoin Transaction Fee Booster");

    // Setup intro gridpane
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    // Intro Text
    Text scenetitle = new Text(
            "Welcome to the fee booster. \n\nWhat type of transaction would you like to boost the fee of?");
    grid.add(scenetitle, 0, 0, 2, 3);

    // radio button selections
    VBox boostRadioVbox = new VBox();
    ToggleGroup boostTypeGroup = new ToggleGroup();
    RadioButton rbfRadio = new RadioButton("A transaction you sent");
    rbfRadio.setToggleGroup(boostTypeGroup);
    boostRadioVbox.getChildren().add(rbfRadio);
    RadioButton cpfpRadio = new RadioButton("A transaction you received");
    cpfpRadio.setToggleGroup(boostTypeGroup);
    rbfRadio.setSelected(true);
    boostRadioVbox.getChildren().add(cpfpRadio);
    grid.add(boostRadioVbox, 0, 3);

    // Instructions Text
    Text instruct = new Text("Please enter the raw hex or transaction id of your transaction below:");
    grid.add(instruct, 0, 4);

    // Textbox for hex of transaction
    TextArea txHexTxt = new TextArea();
    txHexTxt.setWrapText(true);
    grid.add(txHexTxt, 0, 5, 5, 1);

    // Next Button
    Button nextBtn = new Button("Next");
    nextBtn.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {

            // Create Transaction
            Transaction tx = new Transaction();

            // Check if txid
            boolean isTxid = txHexTxt.getText().length() == 64 && txHexTxt.getText().matches("[0-9A-Fa-f]+");
            if (isTxid)
                tx.setHash(txHexTxt.getText());

            // Determine which page to go to
            if (Transaction.deserializeStr(txHexTxt.getText(), tx) || isTxid) {

                // Get the fee
                JSONObject apiResult = Utils
                        .getFromAnAPI("https://api.blockcypher.com/v1/btc/main/txs/" + tx.getHash(), "GET");

                // Get the fee
                tx.setFee(apiResult.getInt("fees"));
                tx.setTotalAmtPre(tx.getFee() + tx.getOutAmt());

                // Get info if txid
                if (isTxid) {

                }

                Scene scene = null;
                if (rbfRadio.isSelected())
                    if (sceneCursor == scenes.size() - 1 || !rbf) {
                        scene = new Scene(rbfGrid(tx), 900, 500);
                        if (!rbf) {
                            scenes.clear();
                            scenes.add(stage.getScene());
                        }
                        rbf = true;
                    }
                if (cpfpRadio.isSelected())
                    if (sceneCursor == scenes.size() - 1 || rbf) {
                        scene = new Scene(cpfpGrid(tx), 900, 500);
                        if (rbf) {
                            scenes.clear();
                            scenes.add(stage.getScene());
                        }
                        rbf = false;
                    }

                if (sceneCursor != scenes.size() - 1)
                    scene = scenes.get(sceneCursor + 1);
                else
                    scenes.add(scene);
                sceneCursor++;
                stage.setScene(scene);
            } else {
                Alert alert = new Alert(Alert.AlertType.ERROR, "Please enter a valid transaction");
                alert.showAndWait();
            }
        }
    });
    HBox btnHbox = new HBox(10);
    btnHbox.getChildren().add(nextBtn);

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

    // Display everything
    Scene scene = new Scene(grid, 900, 500);
    scenes.add(scene);
    primaryStage.setScene(scene);
    primaryStage.show();
}

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);
    inputField.textProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> {
        applyValue.accept(newValue);//from ww  w.  j av  a2  s. c o  m
        this.getGraph().handleChange();
    });
    cf.addOption(propertyName, inputField);
}

From source file:frontend.GUIController.java

@FXML
void showAbout(ActionEvent event) {
    /*Dialogs.create()//  ww w .  j a va  2s. co  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:acmi.l2.clientmod.l2smr.Controller.java

private void onException(String text, Throwable ex) {
    ex.printStackTrace();//from  ww w  .  j  a v a 2s . co  m

    Platform.runLater(() -> {
        if (SHOW_STACKTRACE) {
            Alert alert = new Alert(Alert.AlertType.ERROR);
            alert.setTitle("Error");
            alert.setHeaderText(null);
            alert.setContentText(text);

            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            String exceptionText = sw.toString();

            Label label = new Label("Exception stacktrace:");

            TextArea textArea = new TextArea(exceptionText);
            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);

            alert.getDialogPane().setExpandableContent(expContent);

            alert.showAndWait();
        } else {
            //noinspection ThrowableResultOfMethodCallIgnored
            Throwable t = getTop(ex);

            Alert alert = new Alert(Alert.AlertType.ERROR);
            alert.setTitle(t.getClass().getSimpleName());
            alert.setHeaderText(text);
            alert.setContentText(t.getMessage());

            alert.showAndWait();
        }
    });
}

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

public void actionFileAssayStats() {
    List<String> stats = new ArrayList<>();
    SchemaUtil.gatherAssayStats(stack.peekSchema(), stats);
    String text = String.join("\n", stats);
    Dialog<Boolean> showdlg = new Dialog<>();
    showdlg.setTitle("Assay Stats");

    TextArea area = new TextArea(text);
    area.setWrapText(true);
    area.setPrefWidth(700);//  w  w  w. ja  v a 2 s .c om
    area.setPrefHeight(500);
    showdlg.getDialogPane().setContent(area);

    showdlg.getDialogPane().getButtonTypes().addAll(new ButtonType("OK", ButtonBar.ButtonData.OK_DONE));
    showdlg.setResultConverter(buttonType -> true);
    showdlg.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  . ja v a2s  .  c  o  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();
}