|
Some of your rectangles are outside of the bounds of screen, which cause the program to write outside the bounds of the array. Note that the rectangle takes its parameters as hieght then width, which is the opposite order to the x,y that point takes.
The values you are passing in for Paint are not printable - char value 1 2 3 and 4 are control characters and will display oddly on your screen. Try using '1', '2', etc.
Inside the loop in the rectangle draw function the point to set is in i and j, not x1 and y1 (my example code is wrong too).
|