selecting a color
in
Programming Questions
•
1 year ago
I am making a basic paint program. I made an array of colors. The different colors are displayed on the screen. If the user selects it then it should change to that color.
- int currentColor = #ffffff;
- color[] palette = new color[12];
- palette[0] = color( #000000 );
- etc...
- if( mouseX >= 10 && mouseX <= 30 && mouseX >= 230 && mouseY <= 250 ) currentColor = palette[0];
- etc...
How can I make it so that when the mouse is clicked at a certain spot, currentColor changes to that color? The code compiles and runs but currentColor doesn't change. I tried changing currentColor to a color type but that doesn't work as well.
1