This week's book giveaway is in the Java in General forum. We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line! See this thread for details.
Create an Action, AbstractAction for example. (Action has string or icon or both).
Remember this action in a local variable.
Construct your JMenuItem from that action.
Call someAction.setEnabled(false) whenever you need.
Cheers