public abstract class TableModelComparator
extends java.lang.Object
implements java.util.Comparator
Modifier and Type | Field and Description |
---|---|
protected javax.swing.table.TableModel |
model |
Constructor and Description |
---|
TableModelComparator(javax.swing.table.TableModel model) |
Modifier and Type | Method and Description |
---|---|
void |
addColumn(int column)
Add the column to the sort criteria
|
int |
compare(java.lang.Object row1,
java.lang.Object row2)
Implementation of the comparator method.
|
int |
getColumn()
Get the last column that was sorted
|
abstract java.lang.Object |
getValueForColumn(java.lang.Object obj,
int column)
Returns the value for the comparing object for the
column.
|
boolean |
isAscending() |
void |
setAscending(boolean ascending) |
public TableModelComparator(javax.swing.table.TableModel model)
public void addColumn(int column)
public int getColumn()
public void setAscending(boolean ascending)
public boolean isAscending()
public int compare(java.lang.Object row1, java.lang.Object row2)
compare
in interface java.util.Comparator
public abstract java.lang.Object getValueForColumn(java.lang.Object obj, int column)
obj
- Row object that was passed into Comparator.column
- the column to retrieve Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.