• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable Searching

 
Shyamala Parvathy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I
This is my problem. In JTable which contains many rows ,I will give the column name/column index and the key value. I need to find out which row has this value in that column.
I don't want to go for any manual search or searching algorithm(looping through all the rows)
which consumes a lot of time.Is there any direct searching function in the JTable.
 
Partanen Pasi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

class AbsTab extends AbstractTableModel
...
AbsTab rset2;
...
//A method that searches value "Sunday" from first column.
public void ShowMeSundays()
{for (int i=0;i (Less Than)rset2.getRowCount();i++)
{Object obj = rset2.getValueAt(i, 0);
String objStr =(String)obj;
if (objStr.equals("Sunday"))
System.out.println("Row number "+i+" is Sunday");
}
}
In this case I know where to look Sundays, but You get the point..
Hope this helps!
[This message has been edited by Partanen Pasi (edited July 15, 2001).]
[This message has been edited by Partanen Pasi (edited July 15, 2001).]
[This message has been edited by Partanen Pasi (edited July 15, 2001).]
[This message has been edited by Partanen Pasi (edited July 15, 2001).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!