Reputation: 11539
When JTable
invokes getValueAt()
and that method return a null
value, does it blow up? Or does it just show an empty string ""?
I ask because I've been returning an ""
as null
, but I'm trying to be more explicit with my getClass()
method and "" can clash with nonstring types.
Upvotes: 0
Views: 1160
Reputation: 21223
It depends how the value is rendered. It is up to a particular renderer to draw the actual data. See Concepts: Editors and Renderers for more information.
For example, DefaultTableCellRenderer
that extends JLabel
treats null
like this:
protected void setValue(Object value) {
setText((value == null) ? "" : value.toString());
}
So, null
is interpreted as an empty string.
Upvotes: 5