Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable Custom Cell Editor Problem  RSS feed

 
D R Wilkinson
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello :-)

I am having trouble working out why cell editor part doesn't work.

In the JTable part, the cell renderer works fine but the cell editor throws an "IllegalArgumentException : Cannot format given Object as a Number" when I double click either currency cells in the JTable.



Here is the code for MyCurrencyCellEditor, in case the problem is here...



Thanks

Darren
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems that your formatter is having problems with the Object/String sent to it from the JTable.
I made up a tester to experiment with the formatter. It seems to do okay for most numeric
entries but chokes when there is no currency symbol ahead of the number.
[edit: width of comments above]

[ August 30, 2005: Message edited by: Craig Wood ]
 
D R Wilkinson
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your input Craig but I can't seem to track down what is going wrong here.

The problem seems to center around the setValue() method in the EditorDelegate inner class - more specifically the line

tf.setValue( format );

Aside from this, I am stuck.

Can anyone help on this?

Darren
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exception message will often give the line number in your source file that threw the exception.
You can use this to track down problems.


[edit: comment width]
[ September 05, 2005: Message edited by: Craig Wood ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!