Using a simple variant of the template
method design pattern, you should write your own class,
e.g. UiAction
as a subclass of
javax.swing.AbstractAction
:
public class UiAction extends javax.swing.AbstractAction { final void actionPerformed(ActionEvent ev){ try{ actionPerformedWithThrows(ev); }catch(Exception ex){ multex.Swing.report(ev.getSource(), ex); } } }
This class gets the UI component causing the
event, uses its parent chain to get the owner frame, and will block it
during exception reporting. When using UiAction
instead of javax.swing.AbstractAction
you must
extend UiAction
redefining the method
actionPerformedWithThrows
instead of
actionPerformed
.
See an example at the Central Exception Reporting Sample Application, site https://app.assembla.com/spaces/excrep/git/source