Say the size of my JPanel
is 200 x 200. Is the following pseudo code possible?:
for(int x=0; x< 200;x++){
for(int y=0;y< 200;y++){
if(x%2==0 && y%2==0){
panel.setColor(x-Coord, y-Coord, Color a);
}else{
panel.setColor(x-Coord, y-Coord, Color b);
}
}
}
How can I paint specific pixels of a JPanel
? As you can see I used setColor()
in my pseudo code because I didn't find any predefined method in Java for that. How do I do that?