Having some trouble passing color argument if at all possible when using StdDraw in Java.
What I would like to do is passing a color variable f.e. "RED", "GREEN", "BLUE" to set the pen color of the drawing function to get different color each time I run through for loop.
Here is the code for more details of what I am trying to accomplish.
static void DrawCircleSizeColor()
{
String[] myColorArray = {"RED","GREEN","BLUE"};
double x = 20;
double y = 20;
double r = 20;
int c = 0;
for (int i = 0; i <= 3.0; i++)
{
StdDraw.setPenColor(Color.getColor(myColorArray[c]));
StdDraw.circle(x, y, r);
c++;
r--;
}
Hope you understand my where I am going with this
Thanks -EE
declare your array as:
and use them
Class java.awt.Color has static variables with some standard colors predefined