I'm attempting to create an array of color values (certain values for red, certain values for green, and certain values for blue).
So far i've successfully created the array for those values per each r, g, and b inputs for setting the color, however, I am not able to then input those values into the actual creation of the color.
This is where I'm at so far
/** * Write a description of class ColorSetter here. * * @author (your name) * @version (a version number or a date) */ import java.awt.Color; public class ColorSetter { public int[] redvaluesColor = {45,46,47,48,49,150,}; public int[] greenvaluesColor = {11,12,13,14,15,16,17}; public int[] bluevaluesColor = {70,71,72,73,74,75,76}; public static Color acolor; public void main(String[] args){ acolor = new Color(redvaluesColor, greenvaluesColor, bluevaluesColor); } }
please help asap!
Thank-you!
Below is the error I am getting:
no suitable constructor found for Color(int[],int[],[])
constructor java.awt.Color.Color(java.awt.color.ColorSpace,flo at[],float is not applicable;
(actual argument int[] cannot be converted to java.awt.color.ColorSpace by method invocation conversion);
I understand that the constructor is not applicable for this method, how can I write a code that will store multiple rgb values under one color name?