Performing an action when an JMenuItem is clicked?

前端 未结 5 1687
挽巷
挽巷 2021-01-23 02:17

So i have made a simple program with a basic menu at the top of the frame, Now i just need to put actions behind each JMenuItem. Im struggling to work the code out though, Here

5条回答
  •  隐瞒了意图╮
    2021-01-23 02:40

    Based on the code you posted it looks like it should work, but we can't see the entire context of how the menu item is being used.

    Did you debug your code (with a System.out.println) to see if the ActionListener is being invoked?

    If you need more help post your SSCCE that demonstrates the problem.

提交回复
热议问题