Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Main...
- try{
- launch(args);
- }catch(Throwable ex){
- Alert alert = new Alert(AlertType.ERROR);
- alert.setTitle("Error");
- alert.setHeaderText("Error");
- alert.setContentText("Error!");
- // 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();
- }
- .. koniec maina
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement