Public Static voidCreatealertdialog (FinalString content,FinalException errormsg) {Alert Alert=NewAlert (Alerttype.error); Alert.setheight (250); Alert.setheadertext (NULL); Alert.setcontenttext (content); //Create expandable Exception.Gridpane expcontent =Createexpandablepane (errormsg); //Set Expandable Exception into the dialog pane.Alert.getdialogpane (). Setexpandablecontent (expcontent); Alert.showandwait (); }
View Code
Private StaticGridpane Createexpandablepane (FinalException errormsg) {StringWriter Swriter=NewStringWriter (); PrintWriter pwriter=NewPrintWriter (Swriter); Errormsg.printstacktrace (pwriter); String Exceptiontext=swriter.tostring (); Label Label=NewLabel ("The exception StackTrace was:"); TextArea TextArea=NewTextArea (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=NewGridpane (); Expcontent.setmaxwidth (Double.max_value); Expcontent.add (Label,0, 0); Expcontent.add (TextArea,0, 1); returnexpcontent; }
View Code
JavaFX Popup Displays error stack