I have a BufferedImage that is being drawn onto a JPanel. What I'm trying to do is set the pixels of the BufferedImage by:
for (int yy = 0; yy < 18; yy++) {
for (int xx = 0; xx < 24; xx++) {
image.setRGB(xx * 32, yy * 32, 32, 32, pixels, 0, 32);
}
}
pixels is defined and instantiated, 18 is the height of the image/32 and 24 is the width of the image/32. This method seems to work, but only half of the time. What happens is that it will sometimes draw all of the image, sometimes it will draw maybe the first third of it (then stop), and sometimes it will draw the first 1/5th and then skip to another part of the image and draw some there then stop. No errors thrown, the application isn't pausing or loading. Sometimes it works, sometimes it doesn't. Any reason why this could be occurring?