Search:

Type: Posts; User: Asido

Search: Search took 0.36 seconds.

  1. Replies
    13
    Views
    2,989

    Re: problem with drawing images on JPanel

    Well, thanks all you guys for the help and tips. Everything works fine and moving on with the creation.

    By the way, speaking about JFrames container in Snake class, my way works fine as well:
    ...
  2. Replies
    13
    Views
    2,989

    Re: problem with drawing images on JPanel

    132: appleX = x[random.nextInt(30)];
    140: locateApple();
    The problem is I guess because paint method is called first, and then the Board constructor which initializes x and y arrays.
  3. Replies
    13
    Views
    2,989

    Re: problem with drawing images on JPanel

    I did like aussiemcgr suggested me, but now I get tons of NullPointerExceptions.


    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at...
  4. Replies
    13
    Views
    2,989

    Re: problem with drawing images on JPanel

    Looking at the output after doing that looks everything ok.


    apple: sun.awt.image.ToolkitImage@5fcf29
    head: sun.awt.image.ToolkitImage@125844f ...
  5. Replies
    13
    Views
    2,989

    Re: problem with drawing images on JPanel

    That's embarrassing. I couldn't see that for 3 hours. But unfortunately this didn't solved the problem though. I still can't see the images.
    The previous code throws many NullPointerExceptions after...
  6. Replies
    13
    Views
    2,989

    problem with drawing images on JPanel

    So I am making a simple snake game and have this problem. The pictures just doesn't load. Can anybody tell me what I did wrong?


    import java.awt.Container;
    import java.awt.Graphics;
    import...
Results 1 to 6 of 6