I use SWING for long time but I am amazed how slowly this GUI framework evolve and how far is it comparing to Windows Forms, WPF and Flex. One of the small missing things in Swing is that there is not standard way to display an error message with Exception stacktrace. So I created such dialog and I want to share it with everybody using SWING. The result look like this (shrinked form):

When the dialog is expanded, it shows the exception:

It seems like creating such a dialog is trivial task but unfortunately you need to solve a number of problems related to correct positioning, scrolling issues, etc. When the exception is large, it needs a scroller. When the error description is logn it needs good layout and scroller. This makes the things a little bit challenging. See the code below (the ErrorDilaog class):
The ImageUtils class provides a simplified API for loading images from a file:
The class ImagePanel shows image in a JPanel:
Download the entire example source code (Eclipse project): errordialog.zip.
I hope all this would be helpful to anyone. Enjoy!
Posted by nakov as java, blog at 11:31 PM EET
Comments Off

