Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009
    Posts
    25
    Rep Power
    0

    Default Getting error....picture scaleUp method

    public Picture scaleUp(int numTimes)
    {
    Picture targetPicture = new Picture(this.getWidth()*numTimes, this.getHeight()*numTimes);
    Pixel sourcePixel = null;
    Pixel targetPixel = null;
    int targetX = 0;
    int targetY = 0;

    for(int sourceX = 0; sourceX < this.getWidth(); sourceX++)
    {
    for(int sourceY = 0; sourceY < this.getHeight(); sourceY++)
    {
    sourcePixel = this.getPixel(sourceX,sourceY);

    for(int indexY = 0; indexY < numTimes(); indexY++)
    {
    for(int indexX = 0; indexX < numTimes(); indexX++)

    {
    targetX = sourceX * numTimes + indexX;
    targetY = sourceY * numTimes + indexY;
    targetPixel = targetPicture.getPixel(targetX, targetY);
    targetPixel.setColor(sourcePixel.getColor());
    }
    }
    }
    }
    return targetPicture;
    }


    Errors
    File: C:\intro-prog-java\bookClasses\Picture.java [line: 97]
    Error: cannot find symbol
    symbol : method numTimes()
    location: class Picture
    File: C:\intro-prog-java\bookClasses\Picture.java [line: 99]
    Error: cannot find symbol
    symbol : method numTimes()
    location: class Picture

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,568
    Blog Entries
    7
    Rep Power
    21

    Default

    Leave out those parentheses: numTimes is an int, not a method.

    kind regards,

    Jos

Similar Threads

  1. Non-static method error
    By Lingerz in forum New To Java
    Replies: 1
    Last Post: 09-21-2009, 04:56 PM
  2. an error in paint method
    By hopey in forum Java 2D
    Replies: 7
    Last Post: 04-24-2009, 10:12 PM
  3. Replies: 1
    Last Post: 02-10-2009, 10:03 AM
  4. Error with getString() method in
    By trivektor in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 11-14-2008, 06:30 PM
  5. Error With Simply Displaying Picture
    By JDCAce in forum Java Applets
    Replies: 4
    Last Post: 10-07-2008, 08:09 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •