Newbie Help - Error no X method in X with arguments: ()

Hello all,

Every time I try to run the pict.flipHorizontal(); command in the interactions pane of Dr. Java, I continually get the messageError: No 'flipHorizontal' method in 'Picture' with arguments: ()even though the code below will compile correct. I'm able to view and explore the picture, so I'm not sure what I could be missing.

Any help would be greatly appreciated, thank you. My code is below, thanks.

publicclass FlippingPictureextends Picture

{

public FlippingPicture(String filename)

{

super(filename);

}

public FlippingPicture(int width,int height)

{

super(width,height);

}

public FlippingPicture flipVertical()

{

int width = this.getWidth();

int mirrorPoint = width / 2;

Pixel leftPixel =null;

Pixel rightPixel =null;

for (int y = 0; y < getHeight(); y++)

{

for (int x = 0; x < mirrorPoint; x++)

{

leftPixel = getPixel(x, y);

rightPixel = getPixel(width - 1 - x,y);

rightPixel.setColor(leftPixel.getColor());

}

}

returnnull;

}

public FlippingPicture flipHorizontal()

{

int height = this.getHeight();

int mirrorPoint = height / 2;

Pixel topPixel =null;

Pixel bottomPixel =null;

for (int x=0; x < getWidth(); x++)

{

for (int y=0; y < mirrorPoint; y++)

{

topPixel = getPixel(x,y);

bottomPixel = getPixel(x,height - 1 - y);

bottomPixel.setColor(topPixel.getColor());

}

}

returnnull;

}

}

[3124 byte] By [methylparabexa] at [2007-11-26 20:09:03]
# 1
what is the exact error message ?Also why are you not putting void instead of always returning null ?
Aknibbsa at 2007-7-9 23:12:03 > top of Java-index,Java Essentials,New To Java...
# 2
Sorry if I wasn't clear, here's exactly the error message:Error: No 'flipHorizontal' method in 'Picture' with arguments: ()
methylparabexa at 2007-7-9 23:12:03 > top of Java-index,Java Essentials,New To Java...
# 3
> Sorry if I wasn't clear, here's exactly the error> message:> > Error: No 'flipHorizontal' method in 'Picture'> with arguments: ()What is the line number it occurs at and does flipVertical() work ?
Aknibbsa at 2007-7-9 23:12:03 > top of Java-index,Java Essentials,New To Java...
# 4
You need to post the relevant code. flipHorizontal() is a method in FlippingPicture, not Picture.
CaptainMorgan08a at 2007-7-9 23:12:03 > top of Java-index,Java Essentials,New To Java...
# 5
That's the problem, it will compile correctly, and I receive no errors there - when I try to run these commands - String fileName = FileChooser.pickAFile();Picture picture = new Picture(fileName);picture.flipHorizontal();That's when I receive the
methylparabexa at 2007-7-9 23:12:03 > top of Java-index,Java Essentials,New To Java...
# 6
> You need to post the relevant code.> flipHorizontal() is a method in FlippingPicture, not> Picture.Good point I completely missed that for some reason.
Aknibbsa at 2007-7-9 23:12:03 > top of Java-index,Java Essentials,New To Java...
# 7
Captain,If this is so, then how can I correct my code, this is all I have so far.
methylparabexa at 2007-7-9 23:12:03 > top of Java-index,Java Essentials,New To Java...
# 8
What does the Picture class contain ?
Aknibbsa at 2007-7-9 23:12:03 > top of Java-index,Java Essentials,New To Java...
# 9
> Captain,> > If this is so, then how can I correct my code, this> is all I have so far.I don't know. You have only provided the code for FlippingPicture. The error is occuring somewhere else. You need to post that.
CaptainMorgan08a at 2007-7-9 23:12:03 > top of Java-index,Java Essentials,New To Java...
# 10
> how can I correct my codeMake picture a FlippingPicture or move the flipHorizontal method into the Picture class.
floundera at 2007-7-9 23:12:03 > top of Java-index,Java Essentials,New To Java...