• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JTABLE getValueAt compiling error

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
If you try to please everybody, your progress is limited by the noisiest fool. And this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic