< prev index next >

src/java.desktop/share/classes/sun/swing/UIAction.java

Print this page




  37  *    private static class Actions extends UIAction {
  38  *        Actions(String name) {
  39  *            super(name);
  40  *        }
  41  *
  42  *        public void actionPerformed(ActionEvent ae) {
  43  *            if (getName() == "selectAll") {
  44  *                selectAll();
  45  *            }
  46  *            else if (getName() == "cancelEditing") {
  47  *                cancelEditing();
  48  *            }
  49  *        }
  50  *    }
  51  * </pre>
  52  * <p>
  53  * Subclasses that wish to conditionalize the enabled state should override
  54  * <code>isEnabled(Component)</code>, and be aware that the passed in
  55  * <code>Component</code> may be null.
  56  *
  57  * @see com.sun.java.swing.ExtendedAction
  58  * @see javax.swing.Action
  59  * @author Scott Violet
  60  */
  61 public abstract class UIAction implements Action {
  62     private String name;
  63 
  64     public UIAction(String name) {
  65         this.name = name;
  66     }
  67 
  68     public final String getName() {
  69         return name;
  70     }
  71 
  72     public Object getValue(String key) {
  73         if (key == NAME) {
  74             return name;
  75         }
  76         return null;
  77     }




  37  *    private static class Actions extends UIAction {
  38  *        Actions(String name) {
  39  *            super(name);
  40  *        }
  41  *
  42  *        public void actionPerformed(ActionEvent ae) {
  43  *            if (getName() == "selectAll") {
  44  *                selectAll();
  45  *            }
  46  *            else if (getName() == "cancelEditing") {
  47  *                cancelEditing();
  48  *            }
  49  *        }
  50  *    }
  51  * </pre>
  52  * <p>
  53  * Subclasses that wish to conditionalize the enabled state should override
  54  * <code>isEnabled(Component)</code>, and be aware that the passed in
  55  * <code>Component</code> may be null.
  56  *

  57  * @see javax.swing.Action
  58  * @author Scott Violet
  59  */
  60 public abstract class UIAction implements Action {
  61     private String name;
  62 
  63     public UIAction(String name) {
  64         this.name = name;
  65     }
  66 
  67     public final String getName() {
  68         return name;
  69     }
  70 
  71     public Object getValue(String key) {
  72         if (key == NAME) {
  73             return name;
  74         }
  75         return null;
  76     }


< prev index next >