@RunsInEDT public interface JTableCellWriter
JTable
.Modifier and Type | Method and Description |
---|---|
void |
cancelCellEditing(JTable table,
int row,
int column)
Cancels editing the given cell of the
JTable . |
Component |
editorForCell(JTable table,
int row,
int column)
Returns the AWT or Swing
Component used as editor of the given cell. |
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 . |
void enterValue(@Nonnull JTable table, int row, int column, @Nonnull String value)
JTable
. To edit a cell using this method, it is not
necessary to call startCellEditing(JTable, int, int)
or stopCellEditing(JTable, int, int)
.table
- the target JTable
.row
- the row index of the cell.column
- the column index of the cell.value
- the value to enter.IllegalStateException
- if the JTable
is disabled.IllegalStateException
- if the JTable
is not showing on the screen.IllegalStateException
- if the JTable
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.void startCellEditing(@Nonnull JTable table, int row, int column)
JTable
. This method should be called before manipulating the AWT or
Swing Component
returned by editorForCell(JTable, int, int)
.table
- the target JTable
.row
- the row index of the cell.column
- the column index of the cell.IllegalStateException
- if the JTable
is disabled.IllegalStateException
- if the JTable
is not showing on the screen.IllegalStateException
- if the JTable
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.editorForCell(JTable, int, int)
void stopCellEditing(@Nonnull JTable table, int row, int column)
JTable
. This method should be called after manipulating the AWT or
Swing Component
returned by editorForCell(JTable, int, int)
.table
- the target JTable
.row
- the row index of the cell.column
- the column index of the cell.IllegalStateException
- if the JTable
is disabled.IllegalStateException
- if the JTable
is not showing on the screen.IllegalStateException
- if the JTable
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.editorForCell(JTable, int, int)
void cancelCellEditing(@Nonnull JTable table, int row, int column)
JTable
. This method should be called after manipulating the AWT or
Swing Component
returned by @link #editorForCell(JTable, int, int)}.table
- the target JTable
.row
- the row index of the cell.column
- the column index of the cell.IllegalStateException
- if the JTable
is disabled.IllegalStateException
- if the JTable
is not showing on the screen.IllegalStateException
- if the JTable
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.editorForCell(JTable, int, int)
@Nullable Component editorForCell(@Nonnull JTable table, int row, int column)
Returns the AWT or Swing Component
used as editor of the given cell. To manipulate the returned
Component
, startCellEditing(JTable, int, int)
should be called first.
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);
table
- the target JTable
.row
- the row index of the cell.column
- the column index of the cell.Component
used as editor of the given cell.IllegalStateException
- if the JTable
cell is not editable.IndexOutOfBoundsException
- if any of the indices (row and column) is out of bounds.Copyright © 2014–2019 AssertJ. All rights reserved.