[英]JTable getting values of specific column
How could I get the values under specific column in JTable如何获取 JTable 中特定列下的值
example :例子 :
_________________________
| Column 1 | Column 2 |
________________________
| 1 | a |
________________________
| 2 | b |
________________________
| 3 | c |
_________________________
How could I get the values under Column 1 that is [1, 2, 3] In the form of some data structure ( preferable array)?如何以某种数据结构(优选数组)的形式获取第 1 列下的值 [1, 2, 3]?
you can do something like this你可以做这样的事情
ArrayList list = new ArrayList();
for(int i = 0;i<table.getModel().getRowCount();i++)
{
list.add(table.getModel().getValueAt(i,0)); //get the all row values at column index 0
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.