单击Java中Jtable的列标题时如何选择所有行 [英] how to Select all rows when click on column header of Jtable in Java
本文介绍了单击Java中Jtable的列标题时如何选择所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我是Java初学者,现在在Java中遇到Jtable的问题,
这个问题是当我单击Jtable的列标题时,未选择此列的所有行,
可以帮助我解决这个问题.我想单击列标题时,在Excel或.NET中的datagridview中选择此列的所有行.
感谢
Hi all,
I am Java beginner, now I have a issue with Jtable in Java,
this issue is when I click on column header of Jtable, all rows of this column is not select,
can can help me resolve this problem. I want to when click on column header, All rows of this column is selected the same in Excel or datagridview in .NET.
thanks
推荐答案
您可以控制以下内容:
you can control that:
table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
table.setColumnSelectionAllowed(true);
这应该可以解决问题.
this should do the trick.
这篇关于单击Java中Jtable的列标题时如何选择所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文