Passing color as argument when using StdDraw in java -


having trouble passing color argument if @ possible when using stddraw in java.

what passing color variable f.e. "red", "green", "blue" set pen color of drawing function different color each time run through loop.

here code more details of trying accomplish.

static void drawcirclesizecolor()     {     string[] mycolorarray = {"red","green","blue"};     double x = 20;     double y = 20;     double r = 20;     int c = 0;      (int = 0; <= 3.0; i++)     {          stddraw.setpencolor(color.getcolor(mycolorarray[c]));         stddraw.circle(x, y, r);         c++;         r--;     } 

hope understand going this

thanks -ee

import java.awt.color; 

declare array as:

color[] mycolorarray = {color.red,color.green,color.blue}; 

and use them

stddraw.setpencolor(mycolorarray[c)); 

class java.awt.color has static variables standard colors predefined


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -