java - How to sort rows in JTable based on object property? -
i having jtable catobjects. displaying names. how can when click on table header sort criteria textual name? have sort column in database want use instead. have tried overriding getcolumnclass method of defaulttablemodel seems wrong. can use?
two approaches suggest themselves:
let
catimplementcomparable<cat>, shown in example.supply suitable
comparatorrowsorter, shown in sorting , filtering.
i either case, can delegate, name string, implements comparable<string>.
Comments
Post a Comment