List of usage examples for javafx.scene.control TextArea setMaxWidth
public final void setMaxWidth(double value)
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 www . j a v a2 s .c om*/ 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:com.canoo.dolphin.todo.client.ToDoClient.java
private void showError(String header, String content, Exception e) { e.printStackTrace();/*from ww w . j a v a 2 s . c o m*/ Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Error"); alert.setHeaderText(header); alert.setContentText(content); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.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); alert.getDialogPane().setExpandableContent(expContent); alert.showAndWait(); System.exit(-1); }
From source file:de.perdoctus.ebikeconnect.gui.MainWindowController.java
public void showAbout() throws IOException { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.initOwner(tabPane.getScene().getWindow()); alert.initModality(Modality.WINDOW_MODAL); alert.setWidth(640);/* ww w . j a v a 2 s .c om*/ alert.setTitle(rb.getString("application-name")); alert.setHeaderText(rb.getString("application-name") + " Version " + rb.getString("app-version")); final String aboutInfo = IOUtils.toString(getClass().getResourceAsStream("/about-info.txt"), "UTF-8"); alert.setContentText(aboutInfo); final String licenseInfo = IOUtils.toString(getClass().getResourceAsStream("/license-info.txt"), "UTF-8"); final Label label = new Label(rb.getString("licenses")); final TextArea licenses = new TextArea(licenseInfo); licenses.setMaxWidth(Double.MAX_VALUE); licenses.setEditable(false); GridPane expContent = new GridPane(); expContent.setMaxWidth(Double.MAX_VALUE); expContent.add(label, 0, 0); expContent.add(licenses, 0, 1); alert.getDialogPane().setExpandableContent(expContent); alert.show(); }
From source file:frontend.GUIController.java
@FXML void showAbout(ActionEvent event) { /*Dialogs.create()/*from w ww.j ava2s. 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 w ww .java 2s . 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: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 v a2 s .c o m*/ // 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: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);// ww w. ja v a2 s . 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: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 w w w .j av a 2 s . c om*/ * @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:pah9qdmoviereviews.MovieReviewsFXMLController.java
public void displayExceptionAlert(Exception ex) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Exception"); alert.setHeaderText("An Exception Occurred!"); alert.setContentText(//from w w w. j a v a2 s .co m "An exception occurred. View the exception information below by clicking Show Details."); // Create expandable Exception. StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); ex.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. alert.getDialogPane().setExpandableContent(expContent); alert.showAndWait(); }
From source file:UI.MainStageController.java
/** * creates the file not found alert box// w w w . j a v a 2 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(); }