This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please Help!

 
Peter Phung
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • 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?
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This belongs in the Swing forum, so I'll move it there.
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put return ""; after your switch statement.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic