wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes JTABLE getValueAt compiling error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JTABLE getValueAt compiling error" Watch "JTABLE getValueAt compiling error" New topic
Author

JTABLE getValueAt compiling error

Dean Reedy
Ranch Hand

Joined: Sep 10, 2001
Posts: 89
On the code below in the getValueAt function, when I compile I am getting the following error for the case 2 & 3 & 4,
i.e.
incompatible types:
found: double
required: java.language.Object
case 2: return row.m_last;
^
anyone have any ideas?
Thanks ahead of time.
Dean

(edited by Cindy to format code)
[This message has been edited by Cindy Glass (edited September 21, 2001).]
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Dean,
Your problem is that a primitive value can't be automatically converted into an Object. Your method must return an Object yet you are telling it to return primitives with Case 2, 3, and 4.
To fix the problem you could just use a wrapper class to get an object. For example:
case 2: return( new Double( row.m_last ) );
Then you will need to either use the wrapper object in the calling method or you must get the primitive back out. To get the above value back out use:
double d = returnedValue.doubleValue();
Regards,
Manfred.
 
Don't get me started about those stupid light bulbs.
 
subject: JTABLE getValueAt compiling error
 
Similar Threads
Printing a Database Query
Color in JTable
Adding/Removing rows from a JTable
JTable Dynamic - Urgent
Refresh JTable with New data