Original Post
I am having one hell of a time writing a simple strategy game in Java (actually not a full game, just a tech demo). The problem seems to come from drawImage(). I attempt to draw an image (or a hundred of them- it's a tile-based game and I iterate over a matrix of terrain tiles and display them in order) and I get a null pointer exception. g.drawImage(grass, 40, 40, this); gives me a null-pointer exception? The only thing that could possibly be null would be the last argument, "this", or the component that I'm supposed to draw on. I'm using a single JFrame for my game (at least right now) and I was wondering if there were any special or strange conventions with JFrames that I wasn't aware of, and that can make an error like this occur. Any help at all would be greatly apprecieated- this is driving me up the wall.