JAPI 0_6-alpha-2
Yet another Java API
API Documentation

net.sf.japi.swing
Class DisposeAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by net.sf.japi.swing.DisposeAction
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action

public final class DisposeAction
extends AbstractAction

An Action implementation that disposes a window when activated. Usually, you'd put an instance of this class in an actionmap, eventually pointing an inputmap to it. Usage example:

  JDialog d = new JDialog();
  DisposeAction da = new DisposeAction(d);
  d.getRootPane().getActionMap().put("close", da);
  d.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "close");
 
The convenience method install(JDialog) will do exactly that for an existing JDialog.

Author:
Christian Hujer
See Also:
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
DisposeAction(Window window)
          Create a DisposeAction.
 
Method Summary
 void actionPerformed(ActionEvent e)
          
protected  Object clone()
          
static DisposeAction install(JDialog dialog)
          Install the DisposeAction to a JDialog for the ESCAPE key.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, 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

DisposeAction

public DisposeAction(Window window)
Create a DisposeAction.

Parameters:
window - Window to be disposed when this action is activated
Method Detail

install

public static DisposeAction install(JDialog dialog)
Install the DisposeAction to a JDialog for the ESCAPE key. For most users of this method, the return value is irrelevant and can be ignored.

Parameters:
dialog - JDialog to install to
Returns:
the created DisposeAction

actionPerformed

public void actionPerformed(ActionEvent e)


clone

protected Object clone()
                throws CloneNotSupportedException

Overrides:
clone in class AbstractAction
Throws:
CloneNotSupportedException

JAPI
Yet another Java API
API Documentation

© 2005-2006 Christian Hujer. All rights reserved. See copyright