I'm working on a small GUI application and I've stumbled upon something I can't quite wrap my head around.

I'm retrieving a value from a cell, or many cells actually, in a jTable with the following:

Code:

Object G1P1a = PeakBubTable.getValueAt(0,0);

The jTable is setup so that the data entered is a double.
However, when I retrieve the cell data it is an Object. I need to pass this retrieved cell data (i.e. 7.5, 2.3, etc) to a class that I've written.

I'm getting an error stating that the method in my class cannot be applied to given types. I'm assuming this is because it is being retrieved as an Object, but needs to be a double in order to be utilized in my mathematical equations in my class.

I couldn't find an example similar to what I'm doing. Most examples only show how to populate a table, or simple retrieve cell data and display it, but not actually do anything useful with it.

Any help is greatly appreciated.
Thanks.

08-04-2010, 02:52 AM

Fubarable

What happens if you cast the Object returned to Double type? For example:

That seems to have solved my issue. At first I was trying to simply pass the Object as a double, then I tried to force the Object into double type similar to what you suggested, but I was unfamiliar with how to do that.
Much appreciated. :)