I want to filter a jtable using columns that are in a background array but not shown in the table. What I want to do is score each row, sort the array on the basis of the score and then display the result in a table.
I followed the sorting / filtering tutorial and can display the table and filter it using the columns showing in the table but when I try to write my own sorter using the columns in the array behind it I can't find a way that compiles.
Table
Partno, Description, Size
Array (of type product)
Partno, Description, Size, notes, longdescription, score
The user enters a
string in a text field and that causes a loop through the array updating the score depending on whether it found the string and in which column. I then want to filter the table with only those that have a score > 0 showing and sort them by score.
I have come across a tutorial which says wrap the array in a model but when I do this I get an error saying "Type argument prodmgr.ProductModel is not within bounds of type variable M" I cannot understand this error message (where did it get M from?) and looking for this I can find no example that is similar.
I am using Netbeans (in case that changes anything), this show a rowsorter attribute in the table definition, would there be a way to put some custom code in here to make it sort on a field in the array?
All help appreciated,
Neil