|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTable
gov.nih.nlm.swing.SortableJTable
JTable
that supports sorting of columns. Uses a bunch of code
harvested from Sun's (java.sun.com
)
tutorials. It creates a that can be sorted by clicking on the column headers.
Any normal table model can be passed to the constructor.
Nested Class Summary |
Nested classes inherited from class javax.swing.JTable |
JTable.AccessibleJTable |
Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
SortableJTable()
Instantiates an empty SortableJTable . |
|
SortableJTable(TableModel tm)
Instantiates a SortableJTable from the specified model. |
Method Summary | |
void |
addTableSortListener(TableSortListener tsl)
Adds the specified TableSortListener . |
protected void |
fireTableSortFinished()
Informs listeners that a table sort has finished. |
protected void |
fireTableSortStarted()
Informs listeners that a table sort has started. |
int |
mapIndex(int i)
Maps the row index to the underlying model index. |
void |
removeTableSortListener(TableSortListener tsl)
Removes the specified TableSortListener |
void |
resetSort()
Resets the sorting mechanism to wait until a header is clicked before sorting the table. |
int |
reverseMapIndex(int i)
Maps a real index from the table model to its current row index in the table. |
void |
setModel(TableModel tm)
Sets the model for the table. |
void |
tableChanged(TableModelEvent e)
Handles table change events. |
void |
valueChanged(ListSelectionEvent e)
Called when the list selection changes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public SortableJTable()
SortableJTable
. It is generally a good idea
to call setModel(TableModel)
if you use this constructor.
public SortableJTable(TableModel tm)
SortableJTable
from the specified model.
tm
- the TableModel
Method Detail |
public void setModel(TableModel tm)
tm
- the TableModel
public void resetSort()
public int mapIndex(int i)
i
- a row index in the current table
public int reverseMapIndex(int i)
mapIndex(int)
.
i
- an index in the table model
public void valueChanged(ListSelectionEvent e)
e
- the ListSelectionEvent
public void tableChanged(TableModelEvent e)
TableSorter
, it remaps the row selections to be consistent with
the sort operation.
e
- the TableModelEvent
public void addTableSortListener(TableSortListener tsl)
TableSortListener
.
tsl
- the TableSortListener
public void removeTableSortListener(TableSortListener tsl)
TableSortListener
tsl
- the TableSortListener
protected void fireTableSortStarted()
protected void fireTableSortFinished()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |