简体   繁体   English

如何获取swt.table中的总行数

[英]How to get total number of rows in swt.table

What i want to do is to get all the tableItems from the selected row. 我想要做的是从所选行获取所有tableItems。 but i have find out that the tableItems are stored in indexes (like in arrary) and not like give row and column and store it on specific cell of table (row, column). 但我发现tableItems存储在索引中(如在arrary中),而不是像给出行和列并将它存储在表(行,列)的特定单元格中。

So i have to go through all the next rows upto the end of table and then go through all the rows upto the selected row to get to my required tableItem. 因此,我必须遍历表格末尾的所有下一行,然后遍历所选行的所有行以获取所需的tableItem。

在此输入图像描述

See image for clearance of my question. 请参阅图片以了解我的问题。 The coloured row is the selected one. 彩色行是选定的行。 If i want to go from 'a' to 'b' and then 'c' and so on for complete row, i have go through all the next rows. 如果我想从'a'到'b'然后'c'等等完整的行,我已经完成了所有下一行。

so now the problem is how can i get the total number of rows present in swt.table 所以现在问题是如何获得swt.table中存在的总行数

A SWT TableItem IS a row in your Table. SWT TableItem是表中的一行。 You can use it's getText(int index) method to get the contents of the column with index (starting from 0 for the first column) of the selected TableItem. 您可以使用它的getText(int index)方法来获取所选TableItem的索引(从第一列的0开始)的列的内容。

Therefor the number of TableItems is the total number of rows. 因此,TableItems的数量是总行数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM