Im new in J2ME, and i very interested in canvas because it can do a lot of work but i have trouble is define coordinate X and Y
I try to fill my screen with 2 color Green and Gray but it miss a part above screen:
I need you help
Thank you!!
second occurrence of i * size
in fillRect in rev 3 of your question feels slippery
int size = 50;
for(int i = 0; i < itemsPerLines.length; i++){
int x = 0 + 1, y = i * size,
width = getWidth() - 2, height = size /* not i*size */;
if(i % 2 == 0){
g.setColor(0x00ff00); // green - not 0x0ff000
}else{
g.setColor(0x414141);
}
g.fillRect(x, y, width, height);
g.setColor(0xff00ff); // red + blue? wonder how it looks
int x1 = i * size, y1 = y;
g.drawLine(x, y, x1, y1);
}
}