You may have read an earlier post from me re. the VM crashes (in native territory). I played for a while trying to work out what on earth was wrong with my game.
It turns out the problem came when Java (4.1.2) tried to dispose of the images I'd made using getImage.
1. If i use:
Image image1 = tk.getImage("img1.gif");
Image image2 = tk.getImage("img1.gif");
Image image3 = tk.getImage("img1.gif");
gc.drawImage(image1, x, y, null);
it worked fine, crashed on exit.
but if I replace null with a reference to the frame im drawing onto, it doesn't! That is,
gc.drawImage(image1, x, y, mainFrame);
Why is this? What does the 4th parameter do? Was I wrong to use null in the first place? (jbanes does quite succesfully)
Also, if I store the images in an array rather than under individual identifiers, it works. (What difference should it make?)
Thanks to all those who replied to my original post.
If anyone can point out why these changes stop it crashing, it would help me understand what im doing better. (I now have a frame length of 17ms :-) Thanks for that help too)