List of usage examples for javafx.scene.control TextArea TextArea
public TextArea(String text)
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);//from ww w . j a v a 2s . c o m area.setPrefWidth(700); 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:acmi.l2.clientmod.l2smr.Controller.java
private void onException(String text, Throwable ex) { ex.printStackTrace();/*from w ww . jav a 2 s . c om*/ 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:UI.MainStageController.java
/** * creates the file not found alert box//from ww w . j a v a2 s. c o m */ private void fileNotFoundAlertBox() { fileNotFoundAlert = new Alert(Alert.AlertType.ERROR); fileNotFoundAlert.setTitle("File not found"); fileNotFoundAlert.setHeaderText("File not found"); fileNotFoundAlert.setContentText("Could not find the file you were looking for"); //style the alert DialogPane dialogPane = fileNotFoundAlert.getDialogPane(); dialogPane.getStylesheets().add("/UI/alertStyle.css"); Exception fileNotFoundException = new FileNotFoundException("Could not find your selected file"); //create expandable exception StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); fileNotFoundException.printStackTrace(pw); String exceptionText = sw.toString(); Label label = new Label("The exception stacktrace was: "); 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); // Set expandable Exception into the dialog pane. fileNotFoundAlert.getDialogPane().setExpandableContent(expContent); fileNotFoundAlert.showAndWait(); }