Results 1 to 3 of 3
  1. #1
    Peetahzee is offline Member
    Join Date
    Dec 2009
    Posts
    7
    Rep Power
    0

    Default Accessing ImageObserver?

    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!

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    You can use null in place of the ImageObserver.
    Java Code:
    g.drawImage(image, x, y, null);

  3. #3
    Peetahzee is offline Member
    Join Date
    Dec 2009
    Posts
    7
    Rep Power
    0

    Default

    Nope, that doesn't seem to draw out the image. It's okay then, I'll just figure out someway to draw in chessboard.

Similar Threads

  1. Help: how to set imageObserver
    By xing217sg in forum AWT / Swing
    Replies: 3
    Last Post: 10-21-2009, 06:07 PM
  2. Accessing USB
    By FieryProphet in forum Networking
    Replies: 3
    Last Post: 12-13-2008, 05:29 AM
  3. Accessing file
    By Doctor Cactus in forum New To Java
    Replies: 1
    Last Post: 10-24-2008, 07:31 PM
  4. accessing cddrive
    By milinkp in forum AWT / Swing
    Replies: 2
    Last Post: 02-06-2008, 08:38 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
  •