• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Please Help!

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to extend AbstractTableModel but i am having trouble with one of my methods.

teh error message i get when i try to compilethe code is :
archivetool/resultsTable.java:580: incompatible types
found : int
required: java.lang.Object
case 12: return row.m_fileSize;
Filesize is a field in a database which is created so it has to be an int. Does anyone know what i can do?
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This belongs in the Swing forum, so I'll move it there.
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter,
Look at the signature of getValueAt():

You have to return an Object. You are trying to return a primitive (ie int) so, if you do this:

It should work fine.
Hope this helps
Michael Morris
SCJP2
 
Peter Phung
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've tried what was suggested but i get this error:
archivetool/resultsTable.java:563: missing return statement
public Object getValueAt(int nRow, int nCol) {
the code is now :

If u need to see more code, let me know and i'll post the whole class.
Thanks for your help
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put return ""; after your switch statement.
 
reply
    Bookmark Topic Watch Topic
  • New Topic