I wrote a Swing GUI with several controls related to the same Action subclass. The implementation of the Action subclass follows this psudocode:
public class MyGUI { Gizmo gizmo_;
The action is associated with both the button and the menu item, similar to this psudocode:
act_ = new Action_StartPlayback();
When I click a button or menu item, the actionPerformed action starts correctly, gizmo_ initialized and not null , and everything works as expected, except that the button and menu item are still on.
I was expecting isEnabled to be called โautomaticallyโ again, but this obviously does not happen. isEnabled() is never called again.
This raises two questions:
- How
@Override fit the isEnabled() method, how did I do it? - Assuming the answer to # 1 is yes, how can I call a GUI update to call
isEnabled() again, causing the button and menu item to be disabled?
source share