org.xnap.gui.table
Class SortButtonRenderer

java.lang.Object
  extended by org.xnap.gui.table.SortButtonRenderer
All Implemented Interfaces:
javax.swing.table.TableCellRenderer

public class SortButtonRenderer
extends java.lang.Object
implements javax.swing.table.TableCellRenderer

Don't use this class directly. Use TableHeaderListener.install() instead.

If an instance of this class is set as the header renderer for a table,

See Also:
xnap.gui.table.TableHeaderListener

Field Summary
static javax.swing.Icon downIcon
           
static javax.swing.Icon upIcon
           
 
Constructor Summary
SortButtonRenderer(javax.swing.table.TableCellRenderer renderer)
          Constructs a SortButtonRenderer.
 
Method Summary
 javax.swing.Icon getIcon(int col)
          Returns the icon of col.
 java.awt.Component getTableCellRendererComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, boolean hasFocus, int row, int column)
           
 void selectColumn(int col)
           
 void setSortedColumn(int col, boolean ascending)
          Prints the arrow icon to the column at index col.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

downIcon

public static final javax.swing.Icon downIcon

upIcon

public static final javax.swing.Icon upIcon
Constructor Detail

SortButtonRenderer

public SortButtonRenderer(javax.swing.table.TableCellRenderer renderer)
Constructs a SortButtonRenderer. The renderer is used to renderer the header. This needs to be an instance of JLabel for the sort arrow to be displayed.

This implementation uses the setIcon() method of JLabel to display the arrow icon. Make sure you do not use the icon of the renderer.

Parameters:
renderer - the default renderer
Method Detail

getTableCellRendererComponent

public java.awt.Component getTableCellRendererComponent(javax.swing.JTable table,
                                                        java.lang.Object value,
                                                        boolean isSelected,
                                                        boolean hasFocus,
                                                        int row,
                                                        int column)
Specified by:
getTableCellRendererComponent in interface javax.swing.table.TableCellRenderer

selectColumn

public void selectColumn(int col)

setSortedColumn

public void setSortedColumn(int col,
                            boolean ascending)
Prints the arrow icon to the column at index col.


getIcon

public javax.swing.Icon getIcon(int col)
Returns the icon of col.



Copyright © 2001-2005 XNap Team. All Rights Reserved.