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:de.pixida.logtest.designer.commons.ExceptionDialog.java

public static void showFatalException(final String title, final String message, final Throwable exception) {
    final Alert alert = new Alert(Alert.AlertType.ERROR);
    alert.initStyle(StageStyle.UTILITY);
    alert.setTitle("Error");
    alert.setHeaderText(title);/*from   w w  w.ja va 2s .  com*/
    alert.setContentText(message);

    final Label label = new Label("Details:");

    final TextArea textArea = new TextArea(ExceptionUtils.getStackTrace(exception));
    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);

    final 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();
}

From source file:jlotoprint.MainViewController.java

public static void showExceptionAlert(String message, String details) {
    Alert alert = new Alert(Alert.AlertType.ERROR, message, ButtonType.OK);
    alert.initModality(Modality.APPLICATION_MODAL);
    alert.initOwner(JLotoPrint.stage.getScene().getWindow());
    TextArea textArea = new TextArea(details);
    textArea.setEditable(false);/*from   w  w  w.  j a  v  a 2  s . co  m*/
    textArea.setWrapText(true);

    GridPane grid = new GridPane();
    grid.setPadding(new Insets(10, 10, 0, 10));
    grid.add(textArea, 0, 0);

    //set content
    alert.getDialogPane().setExpandableContent(grid);
    alert.showAndWait();
}

From source file:net.thirdy.blackmarket.controls.Dialogs.java

public static void showExceptionDialog(Throwable throwable) {
    Alert alert = new Alert(AlertType.ERROR);
    alert.setTitle("Sorry something wrong happened");
    String header = throwable.getMessage();
    header = isBlank(header) ? throwable.getClass().getSimpleName() : header;
    alert.setHeaderText(header);/*from   w ww .ja va  2s. c om*/
    //      alert.setGraphic(new ImageView(ImageCache.getInstance().get("/images/gallio/gallio-"
    //            + comics[RandomUtils.nextInt(0, 3)] +
    //            ".png")));
    alert.setGraphic(new ImageView(ImageCache.getInstance().get("/images/gallio/gallio-sad.png")));

    // Create expandable Exception.
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    throwable.printStackTrace(pw);
    String exceptionText = sw.toString();

    StringBuilder sb = new StringBuilder();
    //      sb.append("Error Message: ");
    //      sb.append(System.lineSeparator());
    //      sb.append(throwable.getMessage());
    sb.append("The exception stacktrace was:");
    sb.append(System.lineSeparator());
    sb.append(exceptionText);

    TextArea textArea = new TextArea(sb.toString());
    textArea.setEditable(false);
    textArea.setWrapText(false);

    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(150);

    // Set expandable Exception into the dialog pane.
    alert.getDialogPane().setExpandableContent(textArea);
    alert.getDialogPane().setExpanded(true);

    alert.showAndWait();
}

From source file:jlotoprint.MainViewController.java

public static void loadAboutWindow() {

    //setup/*from w w w .  j a  v  a2 s .  co m*/
    Dialog dialog = new Dialog<>();
    dialog.getDialogPane().getButtonTypes().add(ButtonType.CLOSE);
    dialog.setTitle("About JLotoPanel");
    dialog.setHeaderText("JLotoPanel v1.0");
    ImageView icon = new ImageView("file:resources/icon.png");
    icon.setSmooth(true);
    icon.setFitHeight(48.0);
    icon.setFitWidth(48.0);
    dialog.setGraphic(icon);
    dialog.initModality(Modality.APPLICATION_MODAL);
    dialog.initOwner(JLotoPrint.stage.getScene().getWindow());
    //content
    GridPane grid = new GridPane();
    grid.setPadding(new Insets(10, 10, 0, 10));

    //text
    TextArea textArea = new TextArea("For more info, please visit: https://github.com/mbppower/JLotoPanel");
    textArea.setWrapText(true);
    grid.add(textArea, 0, 0);
    dialog.getDialogPane().setContent(grid);

    dialog.showAndWait();
}

From source file:org.blockedit.utils.ExceptionDialog.java

/**
 * Create a exception alert that is displayed to the user.
 *
 * @param message The message to show the user
 * @param title The title of the window/*from   ww w .  j  a va 2  s.co m*/
 * @param header The message header
 * @param exception The exception that triggered this window to be displayed to the user
 * @return A created alert
 */
private static Alert createDialog(String message, String title, String header, Exception exception) {
    Alert alert = new Alert(Alert.AlertType.ERROR);
    alert.setTitle(title);
    alert.setHeaderText(header);
    alert.setContentText(message);
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    String exceptionText = ExceptionUtils.getStackTrace(exception);
    exception.printStackTrace();
    Label label = new Label("The exception stacktrace was:");
    TextArea exceptionArea = new TextArea(
            exceptionText + "\n\n==User Information==\njava.version = " + System.getProperty("java.version")
                    + "\nos.name = " + System.getProperty("os.name") + "\nos.arch = "
                    + System.getProperty("os.arch") + "\nos.version = " + System.getProperty("os.version"));
    exceptionArea.setEditable(false);
    exceptionArea.setWrapText(true);
    exceptionArea.setMaxWidth(UserInformation.getWindowWidth() / 2);
    exceptionArea.setMaxHeight(UserInformation.getWindowHeight() / 2);
    GridPane.setVgrow(exceptionArea, Priority.ALWAYS);
    GridPane.setHgrow(exceptionArea, Priority.ALWAYS);
    GridPane expContent = new GridPane();
    expContent.setMaxWidth(UserInformation.getWindowWidth() / 2);
    expContent.add(label, 0, 0);
    expContent.add(exceptionArea, 0, 1);
    alert.getDialogPane().setExpandableContent(expContent);
    return alert;
}

From source file:Main.java

public VBox createPage(int pageIndex) {
    VBox box = new VBox(5);
    int page = pageIndex * itemsPerPage();
    for (int i = page; i < page + itemsPerPage(); i++) {
        TextArea text = new TextArea(textPages[i]);
        text.setWrapText(true);
        box.getChildren().add(text);//from w  w  w  . j a v a2  s  .  c o  m
    }
    return box;
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox root = new VBox(5);

    Label textLbl = new Label("Text:");
    TextArea text = new TextArea();
    text.setPrefRowCount(10);//  www  . jav a2  s . c o m
    text.setPrefColumnCount(20);
    text.setWrapText(true);

    // Button to print the TextArea node
    Button printTextBtn = new Button("Print Text");
    printTextBtn.setOnAction(e -> print(text));

    // Button to print the entire scene
    Button printSceneBtn = new Button("Print Scene");
    printSceneBtn.setOnAction(e -> print(root));

    HBox buttonBox = new HBox(5, printTextBtn, printSceneBtn);

    root.getChildren().addAll(textLbl, text, buttonBox);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Printing Nodes");
    stage.show();
}

From source file:net.thirdy.blackmarket.controls.LadderHitsDialog.java

public LadderHitsDialog(ExileToolsHit item) {
    super(AlertType.INFORMATION);
    String title = item.getShop().getSellerAccount()
            + (StringUtils.isBlank(item.getShop().getSellerIGN()) ? LangContants.STRING_EMPTY
                    : (" - " + item.getShop().getSellerIGN()));
    setTitle(title);/* w  ww .j  av  a2s . c o  m*/
    setHeaderText("");
    setGraphic(null);
    String json = item.getLadderHit().toString();

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

    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMinHeight(400);

    getDialogPane().setContent(textArea);
    initModality(Modality.NONE);
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Borders");
    Group root = new Group();
    Scene scene = new Scene(root, 600, 330, Color.WHITE);

    GridPane gridpane = new GridPane();
    gridpane.setPadding(new Insets(5));
    gridpane.setHgap(10);//from   www .j  av  a2s.c o m
    gridpane.setVgap(10);

    final TextArea cssEditorFld = new TextArea();
    cssEditorFld.setPrefRowCount(10);
    cssEditorFld.setPrefColumnCount(100);
    cssEditorFld.setWrapText(true);
    cssEditorFld.setPrefWidth(150);
    GridPane.setHalignment(cssEditorFld, HPos.CENTER);
    gridpane.add(cssEditorFld, 0, 1);

    String cssDefault = "line1;\nline2;\n";

    cssEditorFld.setText(cssDefault);

    root.getChildren().add(gridpane);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:de.chaosfisch.uploader.gui.renderer.TagTextArea.java

private void initTextArea() {
    final TextArea textArea = new TextArea();
    textArea.setWrapText(true);
    textArea.textProperty().bindBidirectional(tags);
    getChildren().add(textArea);//from   ww w . j  ava2s  .co  m
}