Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想要一个监听器来定义是否选择了 JMenuItem。没有按下,只是突出显示。我不需要 MouseOver 侦听器,因为应该从键盘执行选择。我应该使用什么监听器?提前致谢 :)
我猜你会在每个 JMenuItem 的 ButtonModel 中添加一个 ChangeListener。
您应该使用addActionListener。
另请参阅此问题。