Results 1 to 2 of 2
  1. #1
    Publiccarbus is offline Member
    Join Date
    Apr 2012
    Posts
    1
    Rep Power
    0

    Default How do I deal with this error

    My goal is to try to make 6 copies of this one picture. However, I am running into this error....
    Cannot find symbol
    symbol : method getPixel (int,int)

    Do you have any suggestions for how I can change this .this to make it compile?

    import java.awt.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import java.awt.image.BufferedImage;
    import java.text.*;
    import java.util.*;
    import java.util.List;

    public class P3
    {
    public void copyButterfly()
    {
    String sourceFile =
    FileChooser.getMediaPath("butterfly.jpg");
    Picture sourcePicture = new Picture (sourceFile);
    Pixel sourcePixel = null;
    Pixel targetPixel = null;
    //loop through the columns
    for (int sourceX = 0, targetX = 0;
    sourceX < sourcePicture.getWidth();
    sourceX++, targetX++)
    {
    //loop through the rows
    for (int sourceY = 0, targetY = 0;
    sourceY < sourcePicture.getHeight();
    sourceY++, targetY++)
    {
    //set the target pixel color to the source pixel color
    sourcePixel = sourcePicture.getPixel(sourceX,sourceY);
    targetPixel = this.getPixel(targetX,targetY);
    targetPixel.setColor(sourcePixel.getColor());
    }
    }
    return sourcePicture;
    }
    }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: How do I deal with this error

    Quote Originally Posted by Publiccarbus View Post
    ...However, I am running into this error....
    Cannot find symbol
    symbol : method getPixel (int,int)
    ....
    The error message is pretty straight-forward. The class Picture does not have a method getPixel(...) that takes two int parameters. So you'll have to look at the API for the Picture class to see just what public methods you may use.

Similar Threads

  1. How to deal with Arabic string in java
    By mnoko in forum New To Java
    Replies: 3
    Last Post: 04-28-2012, 01:28 PM
  2. Deal with Printer Authentication
    By Namrata.Shah in forum Java Servlet
    Replies: 0
    Last Post: 02-29-2012, 07:12 AM
  3. How do I deal with entries that don't exist
    By Jossos in forum New To Java
    Replies: 11
    Last Post: 01-05-2012, 02:34 AM
  4. How to best deal with large file uploads ?
    By HeapSpace in forum Advanced Java
    Replies: 36
    Last Post: 06-08-2011, 07:32 PM
  5. Replies: 1
    Last Post: 08-07-2007, 05:37 AM

Posting Permissions

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