Error: Missing Return Statement

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Nov 2009
Posts: 3
Reputation: ah124131 is an unknown quantity at this point 
Solved Threads: 0
ah124131 ah124131 is offline Offline
Newbie Poster

Error: Missing Return Statement

 
0
  #1
Nov 2nd, 2009
After completing my code I got an error message at the second to last closing bracket that said I was missing a return statement, I looked in to it online and found that some said to put return 0; but that didn't work it just gave me a new error that said Incompatible types found: int required: Picture . Any suggestions?

  1. public Picture makeGrid(int size)
  2. {
  3. Picture targetPicture = new Picture(this.getWidth()*size, this.getHeight()*size);
  4. Pixel sourcePixel = null;
  5. Pixel targetPixel = null;
  6. int targetX = 0;
  7. int targetY = 0;
  8.  
  9. //loop through the source picture columns
  10. for(int sourceX = 0; sourceX < this.getWidth(); sourceX++)
  11. {
  12. //loop through the source picture rows
  13. for(int sourceY = 0; sourceY < this.getHeight(); sourceY++)
  14. {
  15. // get the source pixel
  16. sourcePixel = this.getPixel(sourceX,sourceY);
  17.  
  18. // loop copying to the target y
  19. for(int indexY = 0; indexY <size; indexY++)
  20. {
  21. // loop copying to the target x
  22. for(int indexX = 0; indexX < size; indexX++)
  23. {
  24. targetX = sourceX + size*2 + indexX;
  25. targetY = sourceY + size*2 + indexY;
  26. targetPixel =targetPicture.getPixel(targetX, targetY);
  27. targetPixel.setColor(sourcePixel.getColor());
  28. }
  29. }
  30. }
  31. }
  32. }
  33. }
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 3
Reputation: ah124131 is an unknown quantity at this point 
Solved Threads: 0
ah124131 ah124131 is offline Offline
Newbie Poster
 
0
  #2
Nov 2nd, 2009
never mind, just figured it out sorry O.o
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 295 | Replies: 1
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC