Class UIAction

java.lang.Object
org.jdesktop.swingx.plaf.UIAction
All Implemented Interfaces:
ActionListener, EventListener, Action
Direct Known Subclasses:
BasicXListUI.Actions, JXEditorPane.Actions, JXTable.Actions, JXTree.Actions, JXTreeTable.Actions

public abstract class UIAction extends Object implements Action
UIAction is the basis of all of basic's action classes that are used in an ActionMap. Subclasses need to override actionPerformed.

A typical subclass will look like:

    private static class Actions extends UIAction {
        Actions(String name) {
            super(name);
        }

        public void actionPerformed(ActionEvent ae) {
            if (getName() == "selectAll") {
                selectAll();
            }
            else if (getName() == "cancelEditing") {
                cancelEditing();
            }
        }
    }
 

Subclasses that wish to conditionalize the enabled state should override isEnabled(Component), and be aware that the passed in Component may be null.

This is based on sun.swing.UIAction in J2SE 1.5

See Also:
  • Field Details

  • Constructor Details

    • UIAction

      public UIAction(String name)
  • Method Details

    • getName

      public final String getName()
    • getValue

      public Object getValue(String key)
      Specified by:
      getValue in interface Action
    • putValue

      public void putValue(String key, Object value)
      Specified by:
      putValue in interface Action
    • setEnabled

      public void setEnabled(boolean b)
      Specified by:
      setEnabled in interface Action
    • isEnabled

      public final boolean isEnabled()
      Cover method for isEnabled(null).
      Specified by:
      isEnabled in interface Action
    • isEnabled

      public boolean isEnabled(Object sender)
      Subclasses that need to conditionalize the enabled state should override this. Be aware that sender may be null.
      Parameters:
      sender - Widget enabled state is being asked for, may be null.
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Specified by:
      addPropertyChangeListener in interface Action
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Specified by:
      removePropertyChangeListener in interface Action