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 TypeMethodDescriptionvoidcancelCellEditing(JTable table, int row, int column) Cancels editing the given cell of the.JTableeditorForCell(JTable table, int row, int column) Returns theused as editor of the given cell.ComponentvoidenterValue(JTable table, int row, int column, String value) Enters the given value at the given cell of the.JTablevoidstartCellEditing(JTable table, int row, int column) Starts editing the given cell of the.JTablevoidstopCellEditing(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 callJTableorstartCellEditing(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 theJTableis disabled.IllegalStateException- if theJTableis not showing on the screen.IllegalStateException- if theJTablecell 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 theJTablereturned 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 theJTableis disabled.IllegalStateException- if theJTableis not showing on the screen.IllegalStateException- if theJTablecell 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 theJTablereturned 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 theJTableis disabled.IllegalStateException- if theJTableis not showing on the screen.IllegalStateException- if theJTablecell 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 theJTablereturned 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 theJTableis disabled.IllegalStateException- if theJTableis not showing on the screen.IllegalStateException- if theJTablecell 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 theused as editor of the given cell. To manipulate the returnedComponentComponent,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
Componentused as editor of the given cell. - Throws:
IllegalStateException- if theJTablecell is not editable.IndexOutOfBoundsException- if any of the indices (row and column) is out of bounds.IllegalStateException- if theJTablecell is not editable.
-