Part of the program that I am creating requires that I ask the user for a character, convert it into a string, and then get individual sections of a buffered image, where the sections are the dimensions of the character/string.
However, the problem occurs when I try to go through the image section by section. The error occurs before the end of the first row of sections of the image, and it has to do with an out of bounds error, like the section of the buffered image I am requesting is outside of the actual dimensions of the buffered image I have.
My Code:
for (int i = 0; i < bufferedimageHeight; i += characterHeight) {
for(int j = 0; j < bufferedimageWidth; j += characterWidth) {
if (myMethod(mybufferedimage.getSubimage(i, j, characterWidth, characterHeight))) {
// TODO CODE HERE
}
}
}
Any help would be much appreciated.
Use: