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;
}
}
Re: How do I deal with this error
Quote:
Originally Posted by
Publiccarbus
...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.