Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

JTable Custom Cell Editor Problem

 
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
 
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 ]
 
Something must be done about this. Let's start by reading this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!