gov.nih.nlm.swing
Class SortButtonRenderer
java.lang.Object
gov.nih.nlm.swing.SortButtonRenderer
- All Implemented Interfaces:
- TableCellRenderer
- public class SortButtonRenderer
- extends Object
- implements TableCellRenderer
TableCellRenderer
for use as s column header in a SortableJTable
.
Displays a BevelArrowIcon
that indicates if sorting should
occur in an ascending or descending order.
Field Summary |
static int |
DOWN
|
static int |
NONE
|
static int |
UP
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NONE
public static final int NONE
- See Also:
- Constant Field Values
DOWN
public static final int DOWN
- See Also:
- Constant Field Values
UP
public static final int UP
- See Also:
- Constant Field Values
SortButtonRenderer
public SortButtonRenderer()
- Instantiates a
SortButtonRenderer
Sets the current icon to BlankIcon
until
the user chooses to sort a column.
getTableCellRendererComponent
public Component getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
- Returns a
JButton
that holds the text and BevelArrowIcon
.
- Specified by:
getTableCellRendererComponent
in interface TableCellRenderer
- Parameters:
table
- the JTable
value
- the valueisSelected
- indicates whether or not it is selectedhasFocus
- indicates whether or not it has focusrow
- row indexcolumn
- column index
- Returns:
- a
JButton
that holds the text and BevelArrowIcon
setState
public void setState(int col,
boolean asc)
- Sets the state of a column for either ascending or descending
sorting.
- Parameters:
col
- a column indexasc
- true
if ascending, false
if descending
Copyright ©2005