为什么JTable总是触发ListSelectionListener两次? [英] Why does JTable always trigger ListSelectionListener twice?

查看:183
本文介绍了为什么JTable总是触发ListSelectionListener两次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于 JTable 的选定行的任何更改都会触发添加的 ListSelectionListener 两次? / p>

可能只能触发 ListSelectionListener

解决方案

查看传递给您的收听者的事件,具体来说,

  ListSelectionEvent.getValueIsAdjusting()

当这个返回false时执行你想要做的任何操作。


Is it normal that any changes to the selected row of the JTable will trigger the added ListSelectionListener twice?

Is it possible that the ListSelectionListener can be triggered only once?

解决方案

Look at the event that is passed to your listener, specifically

ListSelectionEvent.getValueIsAdjusting() 

perform whatever ops you want to do when this returns false.

这篇关于为什么JTable总是触发ListSelectionListener两次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆