dip.gui
Class GUIExceptionHandler

java.lang.Object
  extended bydip.gui.GUIExceptionHandler

public class GUIExceptionHandler
extends java.lang.Object

Handles uncaught exceptions from an AWT event thread. Note that this class does NOT handle uncaught exceptions from non-AWT event threads!

This is an effective but nonportable (it will not work on non-Sun JVMs, and may not work in future Java versions) of handling uncaught exceptions.

This code was derived from a Java Developer Forum post.

Usage

At the beginning of your application set the System property to the name of your exception handler class:
        System.setProperty("sun.awt.exception.handler" ,"dip.gui.GUIExceptionHandler");
        
Alternatively, this can be done transparently with the registerHandler() method.

When an uncaught exception occurs in the EventDispatchThread, it will check the value of "sun.awt.exception.handler", create an instance of the class and call its handle method.


Constructor Summary
GUIExceptionHandler()
          Default Constructor
 
Method Summary
 void handle(java.lang.Throwable thrown)
          Handles the thrown Exception, from an AWT event thread
static boolean registerHandler()
          Registers this GUIExceptionHandler for uncaught Exceptions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GUIExceptionHandler

public GUIExceptionHandler()
Default Constructor

Method Detail

registerHandler

public static boolean registerHandler()
Registers this GUIExceptionHandler for uncaught Exceptions. This will return false if the handler could not be registered.


handle

public void handle(java.lang.Throwable thrown)
Handles the thrown Exception, from an AWT event thread



Copyright 2002-2004 Zachary DelProposto / jDip Development Team. All Rights Reserved.