gov.nih.nlm.swing
Class SortButtonRenderer

java.lang.Object
  extended bygov.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
           
 
Constructor Summary
SortButtonRenderer()
          Instantiates a SortButtonRenderer Sets the current icon to BlankIcon until the user chooses to sort a column.
 
Method Summary
 Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
          Returns a JButton that holds the text and BevelArrowIcon.
 void setState(int col, boolean asc)
          Sets the state of a column for either ascending or descending sorting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

SortButtonRenderer

public SortButtonRenderer()
Instantiates a SortButtonRenderer Sets the current icon to BlankIcon until the user chooses to sort a column.

Method Detail

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 value
isSelected - indicates whether or not it is selected
hasFocus - indicates whether or not it has focus
row - row index
column - 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 index
asc - true if ascending, false if descending


Copyright ©2005