JComboBox,当我需要在选择状态(不必是新的)后捕获鼠标单击时,什么侦听器?
无法使用 ItemListener
因为我的 JComboBox 项目是动态生成的,因此当列表为空时会生成异常。 我需要基本上捕获某个项目上的鼠标单击事件后的状态(MouseListener 的问题是,即使我打开 JComboBox 中的项目列表,它也会捕获该事件)。
Can't use an ItemListener
because my JComboBox items are generated dinamically so that would generate exceptions when the list is empty.
I need to catch basically the state after a mouse click event on an item (the problem with MouseListener is that it catches the event even when I open the list of items in the JComboBox).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用
ActionListener
。请参阅如何使用组合框。特别是处理组合框上的事件部分。
Try to use
ActionListener
.See How to Use Combo Boxes. Especially Handling Events on a Combo Box section.