How may I use g.setColor() with a variable?
843785Sep 15 2008 — edited Sep 15 2008I'm trying to use a variable in the method setColor(), and apperars an error:
public void paint(Graphics g){
String colores = "black"; //variable storing the color
g.setColor(Color.colores);
g.drawRect(10,90,180,210);
}
ERROR:
cannot find symbol
symbol : variable colores
location : class java.awt.Color
g.setColor(Color.colores);
1 error
What's wrong ??