Advertisement
kator

Untitled

Jan 22nd, 2017
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. Main...
  2. try{
  3. launch(args);
  4. }catch(Throwable ex){
  5. Alert alert = new Alert(AlertType.ERROR);
  6. alert.setTitle("Error");
  7. alert.setHeaderText("Error");
  8. alert.setContentText("Error!");
  9.  
  10. // Create expandable Exception.
  11. StringWriter sw = new StringWriter();
  12. PrintWriter pw = new PrintWriter(sw);
  13. ex.printStackTrace(pw);
  14. String exceptionText = sw.toString();
  15.  
  16. Label label = new Label("The exception stacktrace was:");
  17.  
  18. TextArea textArea = new TextArea(exceptionText);
  19. textArea.setEditable(false);
  20. textArea.setWrapText(true);
  21.  
  22. textArea.setMaxWidth(Double.MAX_VALUE);
  23. textArea.setMaxHeight(Double.MAX_VALUE);
  24. GridPane.setVgrow(textArea, Priority.ALWAYS);
  25. GridPane.setHgrow(textArea, Priority.ALWAYS);
  26.  
  27. GridPane expContent = new GridPane();
  28. expContent.setMaxWidth(Double.MAX_VALUE);
  29. expContent.add(label, 0, 0);
  30. expContent.add(textArea, 0, 1);
  31.  
  32. // Set expandable Exception into the dialog pane.
  33. alert.getDialogPane().setExpandableContent(expContent);
  34.  
  35. alert.showAndWait();
  36. }
  37. .. koniec maina
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement