|
|||||||||
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
schmitzm.swing.SelectableJTable
schmitzm.swing.SortableJTable
public class SortableJTable
Extends the JTable
with automatic sort functionality.
This class adds the following methods so that manually calling
JTable.convertRowIndexToModel(int)
and JTable.convertRowIndexToView(int)
is not necessary:
getEditingModelRow()
getSelectedModelRow()
getSelectedModelRows()
addModelRowSelectionInterval(int, int)
setModelRowSelectionInterval(int, int)
JTable.removeRowSelectionInterval(int, int)
changeModelSelection(int, int, boolean, boolean)
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JTable |
---|
JTable.AccessibleJTable, JTable.DropLocation, JTable.PrintMode |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, 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()
Creates an empty table. |
|
SortableJTable(int numRows,
int numColumns)
Creates an empty table. |
|
SortableJTable(Object[][] rowData,
Object[] columnNames)
Creates a new table. |
|
SortableJTable(TableModel dm)
Creates a new table. |
|
SortableJTable(TableModel dm,
TableColumnModel cm)
Creates a new table. |
|
SortableJTable(TableModel dm,
TableColumnModel cm,
ListSelectionModel sm)
Creates a new table. |
|
SortableJTable(Vector rowData,
Vector columnNames)
Creates a new table. |
Method Summary | |
---|---|
void |
addModelRowSelectionInterval(int index0,
int index1)
Extends the current selection by the given index interval according to the table model. |
void |
changeModelSelection(int row,
int col,
boolean toggle,
boolean extend)
Changes the selected cells. |
int |
getEditingModelRow()
Returns the index of the currently edited row according to the table model. |
int |
getSelectedModelRow()
Returns the index of the selected row according to the table model. |
int[] |
getSelectedModelRows()
Returns the indices of the selected rows according to the table model. |
protected void |
initTable()
Called by every constructor to initialize the extended functionalities. |
void |
removeModelRowSelectionInterval(int index0,
int index1)
Removes the given index interval of rows from the current selection according to the table model. |
void |
setModelRowSelectionInterval(int index0,
int index1)
Sets the current selection to the given index interval according to the table model. |
Methods inherited from class schmitzm.swing.SelectableJTable |
---|
changeSelection |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SortableJTable()
public SortableJTable(int numRows, int numColumns)
public SortableJTable(Object[][] rowData, Object[] columnNames)
public SortableJTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm)
public SortableJTable(TableModel dm, TableColumnModel cm)
public SortableJTable(TableModel dm)
public SortableJTable(Vector rowData, Vector columnNames)
Method Detail |
---|
protected void initTable()
initTable
in class SelectableJTable
public int getEditingModelRow()
public int getSelectedModelRow()
public int[] getSelectedModelRows()
public void changeModelSelection(int row, int col, boolean toggle, boolean extend)
row
- row indexcol
- column indextoggle
- see SelectableJTable.changeSelection(int, int, boolean, boolean)
extend
- see SelectableJTable.changeSelection(int, int, boolean, boolean)
public void addModelRowSelectionInterval(int index0, int index1)
index0
- start indexindex1
- end index (inclusive)public void setModelRowSelectionInterval(int index0, int index1)
index0
- start indexindex1
- end index (inclusive)public void removeModelRowSelectionInterval(int index0, int index1)
index0
- start indexindex1
- end index (inclusive)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |