Package org.fest.swing.cell
Interface JTableCellWriter
- All Known Implementing Classes:
AbstractJTableCellWriter
,BasicJTableCellWriter
,JTableCheckBoxEditorCellWriter
,JTableComboBoxEditorCellWriter
,JTableTextComponentEditorCellWriter
Understands how to edit the value of a cell in a
JTable
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
cancelCellEditing
(JTable table, int row, int column) Cancels editing the given cell of the
.JTable
editorForCell
(JTable table, int row, int column) Returns the
used as editor of the given cell.Component
void
enterValue
(JTable table, int row, int column, String value) Enters the given value at the given cell of the
.JTable
void
startCellEditing
(JTable table, int row, int column) Starts editing the given cell of the
.JTable
void
stopCellEditing
(JTable table, int row, int column) Stops editing the given cell of the
.JTable
-
Method Details
-
enterValue
Enters the given value at the given cell of the
. To edit a cell using this method, it is not necessary to callJTable
orstartCellEditing(JTable, int, int)
.stopCellEditing(JTable, int, int)
- Parameters:
table
- the targetJTable
.row
- the row index of the cell.column
- the column index of the cell.value
- the value to enter.- Throws:
IllegalStateException
- if theJTable
is disabled.IllegalStateException
- if theJTable
is not showing on the screen.IllegalStateException
- if theJTable
cell is not editable.IndexOutOfBoundsException
- if any of the indices (row and column) is out of bounds.ActionFailedException
- if an editor for the given cell cannot be found or cannot be activated.
-
startCellEditing
Starts editing the given cell of the
. This method should be called before manipulating theJTable
returned byComponent
.editorForCell(JTable, int, int)
- Parameters:
table
- the targetJTable
.row
- the row index of the cell.column
- the column index of the cell.- Throws:
IllegalStateException
- if theJTable
is disabled.IllegalStateException
- if theJTable
is not showing on the screen.IllegalStateException
- if theJTable
cell is not editable.IndexOutOfBoundsException
- if any of the indices (row and column) is out of bounds.ActionFailedException
- if an editor for the given cell cannot be found or cannot be activated.- See Also:
-
stopCellEditing
Stops editing the given cell of the
. This method should be called after manipulating theJTable
returned byComponent
.editorForCell(JTable, int, int)
- Parameters:
table
- the targetJTable
.row
- the row index of the cell.column
- the column index of the cell.- Throws:
IllegalStateException
- if theJTable
is disabled.IllegalStateException
- if theJTable
is not showing on the screen.IllegalStateException
- if theJTable
cell is not editable.IndexOutOfBoundsException
- if any of the indices (row and column) is out of bounds.ActionFailedException
- if an editor for the given cell cannot be found or cannot be activated.- See Also:
-
cancelCellEditing
Cancels editing the given cell of the
. This method should be called after manipulating theJTable
returned byComponent
.editorForCell(JTable, int, int)
- Parameters:
table
- the targetJTable
.row
- the row index of the cell.column
- the column index of the cell.- Throws:
IllegalStateException
- if theJTable
is disabled.IllegalStateException
- if theJTable
is not showing on the screen.IllegalStateException
- if theJTable
cell is not editable.IndexOutOfBoundsException
- if any of the indices (row and column) is out of bounds.ActionFailedException
- if an editor for the given cell cannot be found or cannot be activated.- See Also:
-
editorForCell
Returns the
used as editor of the given cell. To manipulate the returnedComponent
Component
,
should be called first.startCellEditing(JTable, int, int)
Example:
Component editor = writer.editorForCell(table, 6, 8); // assume editor is a JTextField JTextComponentFixture editorFixture = new JTextComponentFixture(robot, (JTextField) editor); writer.
startCellEditing
(table, 6, 8); editorFixture.enterText("Hello"); writer.stopCellEditing
(table, 6, 8);- Parameters:
table
- the targetJTable
.row
- the row index of the cell.column
- the column index of the cell.- Returns:
- the
Component
used as editor of the given cell. - Throws:
IllegalStateException
- if theJTable
cell is not editable.IndexOutOfBoundsException
- if any of the indices (row and column) is out of bounds.IllegalStateException
- if theJTable
cell is not editable.
-