I have a JPopupMenu
and I want to disable or remove, if possible, a menu item every time an action happens. So I tried this, and though the removeCommentAction
object is added in the position 4 of the menu, the menu item in position 4 is not removed.
I know about the menu item method setEnabled but how can this be implemented in this case with the AbstractAction
object?
nodeMenu.remove(4);
nodeMenu.insert(new RemoveCommentAction(),4)
Thank you.