Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Format error when editing a JTable cell

0 views
Skip to first unread message

William

unread,
Oct 11, 1999, 3:00:00 AM10/11/99
to
OK, so I downloaded & installed swing and am playing with the
TableExample.java that came with swing 1.1.1

I would like to be able to edit a cell and have it automatically update
the databse. I edited JDBCAdapter.java's method isCellEditable to return
true, and I can click in the cell and change it. But here's the problem:
when I click out of the cell so it registers the change, I get the
following error after I click in the code:

Exception occurred during event dispatching:
java.lang.IllegalArgumentException: Cannot format given Object as a
Number
at java.text.NumberFormat.format(NumberFormat.java)
at java.text.Format.format(Format.java)
at javax.swing.JTable$7.setValue(JTable.java:2680)
at
javax.swing.table.DefaultTableCellRenderer.getTableCellRendererComponent(DefaultTableCellRenderer.java:122)

at javax.swing.JTable.prepareRenderer(JTable.java:2897)
at
javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:968)
at
javax.swing.plaf.basic.BasicTableUI.paintRow(BasicTableUI.java:899)
at
javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:811)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:43)
...

I am only putting in numbers in the cell. What's more, JDBCAdapter's
setValue method is being called, so I am updating the database with my
new value! The only problem is this ridiculous exception. Does anyone
have any ideas what's causing it?

Thanks,

William

(note--this was also posted to the comp.lang.java.gui newsgroup)

0 new messages