Color []color = new Color[2];
color[0] = Color.red;
.....

解决方案 »

  1.   

    Color varColor[]=new Color[3];

    >varColor[0]=Color.red;
              ^           ^
    >varColor[1]=Color.blue;
              ^            ^
    >varColor[2]=Color.yellow;
              ^              ^赋值时出错:
    期望 "]"

    期望 <indentifier>如何办?
      

  2.   

    Color color[] = new Color[3];
    color[0] = Color.red;
    color[1] = Color.blue;
    color[2] = Color.yellow;没有什么错误,可能是你多写或少写了怎么符号!再查检程序
      

  3.   

    我的问题没阐述清晰,先加30分刚才犯了个低级错误,赋值语句放错地方了,呵呵~~~我想的是从一个String字符串数组来设置颜色,可是
    Color.getColor(String[])无法设置,我想这个函数应该可以吧
    可能我用错了,请教
      

  4.   

    public static Color getColor(String nm)
    Finds a color in the system properties. The argument is treated as the name of a system property to be obtained. The string value of this property is then interpreted as an integer which is then converted to a color. If the specified property is not found, or could not be parsed as an integer, then null is returned.Parameters:
    nm - the name of the color property
    Returns:
    the color value of the property.
      

  5.   


    问题已经解决应该是
    color=new Color(Integer.parseInt(string,16));
    不过还是谢谢各位回答