|
Groovy Documentation | |||||||
| 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
com.wordpress.tipsforjava.swing.table.RXTable
public class RXTable extends JTable
The RXTable provides some extensions to the default JTable 1) Select All editing - when a text related cell is placed in editing mode the text is selected. Controlled by invoking a "setSelectAll..." method. 2) reorderColumns - static convenience method for reodering table columns
| Field Summary | |
|---|---|
private boolean |
isSelectAllForActionEvent
|
private boolean |
isSelectAllForKeyEvent
|
private boolean |
isSelectAllForMouseEvent
|
| Fields inherited from class JTable | |
|---|---|
| AUTO_RESIZE_OFF, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_SUBSEQUENT_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_ALL_COLUMNS, WHEN_FOCUSED, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_WINDOW, UNDEFINED_CONDITION, TOOL_TIP_TEXT_KEY, TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, WIDTH, HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR, ABORT |
| Fields inherited from class JComponent | |
|---|---|
| WHEN_FOCUSED, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_WINDOW, UNDEFINED_CONDITION, TOOL_TIP_TEXT_KEY, TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, WIDTH, HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR, ABORT |
| Constructor Summary | |
RXTable()
Constructs a default |
|
RXTable(TableModel dm)
Constructs a |
|
RXTable(TableModel dm, TableColumnModel cm)
Constructs a |
|
RXTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm)
Constructs a |
|
RXTable(int numRows, int numColumns)
Constructs a |
|
RXTable(Vector rowData, Vector columnNames)
Constructs a |
|
RXTable(Object[] rowData, Object[] columnNames)
Constructs a |
|
| Method Summary | |
|---|---|
boolean
|
editCellAt(int row, int column, EventObject e)
|
static void
|
reorderColumns(JTable table, Object... columnNames)
Convenience method to order the table columns of a table. |
private void
|
selectAll(EventObject e)
|
void
|
setSelectAllForActionEvent(boolean isSelectAllForActionEvent)
|
void
|
setSelectAllForEdit(boolean isSelectAllForEdit)
|
void
|
setSelectAllForKeyEvent(boolean isSelectAllForKeyEvent)
|
void
|
setSelectAllForMouseEvent(boolean isSelectAllForMouseEvent)
|
| Field Detail |
|---|
private boolean isSelectAllForActionEvent
private boolean isSelectAllForKeyEvent
private boolean isSelectAllForMouseEvent
| Constructor Detail |
|---|
public RXTable()
RXTable that is initialized with a default
data model, a default column model, and a default selection
model.
public RXTable(TableModel dm)
RXTable that is initialized with
dm as the data model, a default column model,
and a default selection model.
dm - the data model for the table
public RXTable(TableModel dm, TableColumnModel cm)
RXTable that is initialized with
dm as the data model, cm
as the column model, and a default selection model.
dm - the data model for the tablecm - the column model for the table
public RXTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm)
RXTable that is initialized with
dm as the data model, cm as the
column model, and sm as the selection model.
If any of the parameters are null this method
will initialize the table with the corresponding default model.
The autoCreateColumnsFromModel flag is set to false
if cm is non-null, otherwise it is set to true
and the column model is populated with suitable
TableColumns for the columns in dm.
dm - the data model for the tablecm - the column model for the tablesm - the row selection model for the table
public RXTable(int numRows, int numColumns)
RXTable with numRows
and numColumns of empty cells using
DefaultTableModel. The columns will have
names of the form "A", "B", "C", etc.
numRows - the number of rows the table holdsnumColumns - the number of columns the table holds
public RXTable(Vector rowData, Vector columnNames)
RXTable to display the values in the
Vector of Vectors, rowData,
with column names, columnNames. The
Vectors contained in rowData
should contain the values for that row. In other words,
the value of the cell at row 1, column 5 can be obtained
with the following code:
((Vector)rowData.elementAt(1)).elementAt(5);
rowData - the data for the new tablecolumnNames - names of each column
public RXTable(Object[] rowData, Object[] columnNames)
RXTable to display the values in the two dimensional array,
rowData, with column names, columnNames.
rowData is an array of rows, so the value of the cell at row 1,
column 5 can be obtained with the following code:
rowData[1][5];
All rows must be of the same length as columnNames.
rowData - the data for the new tablecolumnNames - names of each column
| Method Detail |
|---|
public boolean editCellAt(int row, int column, EventObject e)
public static void reorderColumns(JTable table, Object... columnNames)
table - the table containing the columns to be sortedcolumnNames - an array containing the column names in the
order they should be displayed
private void selectAll(EventObject e)
public void setSelectAllForActionEvent(boolean isSelectAllForActionEvent)
public void setSelectAllForEdit(boolean isSelectAllForEdit)
public void setSelectAllForKeyEvent(boolean isSelectAllForKeyEvent)
public void setSelectAllForMouseEvent(boolean isSelectAllForMouseEvent)
Groovy Documentation