-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
6
-
x86
-
solaris_10
A DESCRIPTION OF THE REQUEST :
I had a ActionListener that I wanted to use within an ActionMap, which requires an Action. I had to subclass AbstractAction to put it in the ActionMap:
Action a= new AbstractAction(){
public void actionPerformed(ActionEvent e){
ActionListenerThing.actionPerformed(e);
}
};
Considering the simplicity of subclassing this, would it not be easier for the user in this situation to have a factory method that does all this for the user:
Action a = AbstractAction.createAction(ActionListenerThing, null, null);
public static AbstractAction createAction(ActionListener listener, String name, Icon icon){....}
JUSTIFICATION :
would make wrapping an ActionListener easier, it seems a good fit in that both are ActionListeners.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
easy to wrap and ActionListener in an AbstractAction
ACTUAL -
must subclass when a wrapper could easily be used.
---------- BEGIN SOURCE ----------
look at JDK source of AbstractAction, there is no wrapper method.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
subclass AbstractAction
I had a ActionListener that I wanted to use within an ActionMap, which requires an Action. I had to subclass AbstractAction to put it in the ActionMap:
Action a= new AbstractAction(){
public void actionPerformed(ActionEvent e){
ActionListenerThing.actionPerformed(e);
}
};
Considering the simplicity of subclassing this, would it not be easier for the user in this situation to have a factory method that does all this for the user:
Action a = AbstractAction.createAction(ActionListenerThing, null, null);
public static AbstractAction createAction(ActionListener listener, String name, Icon icon){....}
JUSTIFICATION :
would make wrapping an ActionListener easier, it seems a good fit in that both are ActionListeners.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
easy to wrap and ActionListener in an AbstractAction
ACTUAL -
must subclass when a wrapper could easily be used.
---------- BEGIN SOURCE ----------
look at JDK source of AbstractAction, there is no wrapper method.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
subclass AbstractAction