org.thdl.util
Class ThdlAbstractAction

java.lang.Object
  |
  +--javax.swing.AbstractAction
        |
        +--org.thdl.util.ThdlAbstractAction
All Implemented Interfaces:
Action, ActionListener, Cloneable, EventListener, Serializable

public class ThdlAbstractAction
extends AbstractAction

This ActionListener is like any other except in the way that it handles exceptions or errors thrown during the execution of actionPerformed(). Because event listeners are on threads, an exception during actionPerformed() is just printed out on the console by java.awt.EventDispatchThread.run(). It does not cause the program to terminate. In our code, it helps developers more quickly get to the root of a problem if the program terminates as soon after a problem as possible. Thus, this class calls System.exit(1) when an exception is throw by theRealActionPerformed(), which is the method that subclasses should implement.

Author:
David Chandler There is a pertinent Usenet thread at http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=utf-8&threadm=6ntgl6%244hl%241%40tarantula.europe.shiva.com&rnum=2&prev=/groups%3Fq%3Dexception%2BactionPerformed%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3Dutf-8%26selm%3D6ntgl6%25244hl%25241%2540tarantula.europe.shiva.com%26rnum%3D2.
See Also:
ThdlActionListener, Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
ThdlAbstractAction(String s, Icon i)
          Just calls the super's constructor with the same args.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Subclasses don't override this.
protected  void theRealActionPerformed(ActionEvent e)
          Subclasses should override this method to do the real action performed.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThdlAbstractAction

public ThdlAbstractAction(String s,
                          Icon i)
Just calls the super's constructor with the same args.

Method Detail

actionPerformed

public final void actionPerformed(ActionEvent e)
Subclasses don't override this. Instead, they override theRealActionPerformed().

See Also:
actionPerformed(ActionEvent)

theRealActionPerformed

protected void theRealActionPerformed(ActionEvent e)
                               throws Throwable
Subclasses should override this method to do the real action performed.

Throwable
See Also:
actionPerformed(ActionEvent)


These API docs were created 02/02/2003 08:19 PM.
Copyright © 2001-2002 Tibetan and Himalayan Digital Library. All Rights Reserved.
Hosted by SourceForge_Logo