2

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.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
PetMarion
  • 147
  • 3
  • 14

0 Answers0