public class BasicJTableCellReader extends Object implements JTableCellReader
JTableCellReader
.Constructor and Description |
---|
BasicJTableCellReader()
Creates a new
BasicJTableCellReader that uses a BasicCellRendererReader to read the value from the
cell renderer component in a JTable . |
BasicJTableCellReader(CellRendererReader reader)
Creates a new
BasicJTableCellReader . |
Modifier and Type | Method and Description |
---|---|
Color |
backgroundAt(JTable table,
int row,
int column)
Returns the background color of the cell renderer for the given
JTable cell. |
Font |
fontAt(JTable table,
int row,
int column)
Returns the font of the cell renderer for the given
JTable cell. |
Color |
foregroundAt(JTable table,
int row,
int column)
Returns the foreground color of the cell renderer for the given
JTable cell. |
String |
valueAt(JTable table,
int row,
int column)
Returns the internal value of a cell in a
JTable as expected in a test. |
public BasicJTableCellReader()
BasicJTableCellReader
that uses a BasicCellRendererReader
to read the value from the
cell renderer component in a JTable
.public BasicJTableCellReader(@Nonnull CellRendererReader reader)
BasicJTableCellReader
.reader
- knows how to read values from the cell renderer component in a JTable
.NullPointerException
- if reader
is null
.@RunsInCurrentThread @Nullable public String valueAt(@Nonnull JTable table, int row, int column)
Returns the internal value of a cell in a JTable
as expected in a test. This method first tries to return
the value displayed in the JTable
's cell renderer.
JLabel
, this method returns its textJComboBox
, this method returns the value of its selection as a String
JCheckBox
, this method returns whether it is selected or not
If it fails reading the cell renderer, this method will get the value from the toString
implementation of
the object stored in the JTable
's model at the specified indices.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT). Client code must call this method from the EDT.
valueAt
in interface JTableCellReader
table
- the given JTable
.row
- the row index of the cell.column
- the column index of the cell.JTable
as expected in a test.@RunsInCurrentThread @Nullable public Font fontAt(@Nonnull JTable table, int row, int column)
Returns the font of the cell renderer for the given JTable
cell.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT). Client code must call this method from the EDT.
fontAt
in interface JTableCellReader
table
- the given JTable
.row
- the row index of the cell.column
- the column index of the cell.JTable
cell.@RunsInCurrentThread @Nullable public Color backgroundAt(@Nonnull JTable table, int row, int column)
Returns the background color of the cell renderer for the given JTable
cell.
backgroundAt
in interface JTableCellReader
table
- the given JTable
.row
- the row index of the cell.column
- the column index of the cell.JTable
cell.@RunsInCurrentThread @Nullable public Color foregroundAt(@Nonnull JTable table, int row, int column)
Returns the foreground color of the cell renderer for the given JTable
cell.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT). Client code must call this method from the EDT.
foregroundAt
in interface JTableCellReader
table
- the given JTable
.row
- the row index of the cell.column
- the column index of the cell.JTable
cell.Copyright © 2014–2020 AssertJ. All rights reserved.