I just learned Java and OO concepts, but still don't fully know how to work with it. I am supposed to design part of a chess program for my Computer Science class in high school, and this is what I have now:
chessboard extends Applet, has the public void paint() function. It instantiates Pawn, a Chesspiece subclass, and draws itself out with g.drawImage(). Now the problem is: what do I put in for the ImageObserver parameter?
I know if I was to call g.drawImage in chessboard, all I need is "this". Is there anyway without using parameters (I will have to change quite a lot of lines, and considering I will always use the same ImageObserver, there is no reason to create a separate ImageObserver parameter) to access the ImageObserver used at chessboard?
I'm sorry if this question sounds confusing, I'm trying my very best to explain it... thanks in advanced for any input!
You can use null in place of the ImageObserver.
g.drawImage(image, x, y, null);
Nope, that doesn't seem to draw out the image. It's okay then, I'll just figure out someway to draw in chessboard.