如题

解决方案 »

  1.   

    button2.setBackground(Color.red);或是
    button2.setBackground(new Color(255,255,255));
      

  2.   

    Timer td=new Timer();//定时类
    td.schedule(new TimerTask(){
    String  colors[]={"red","green","white","yellow"};
    int i=0;
    @Override
        public void run() {
             String a = colors[i++];
             b13.setBackground(Color.a);
             if(i>=colors.length){ i=0;}
       } 
    }, 0,1000);//从0秒开始,每隔1秒执行一次这个程序怎么有错误啊?此时a不能用吗?为什么?如果用red代替a就对了,这究竟是怎么回事啊?
      

  3.   

    Timer td=new Timer();//定时类
    td.schedule(new TimerTask(){
    String  colors[]={"red","green","white","yellow"};
    int i=0;
    @Override
        public void run() {
             String a = colors[i++];
             b13.setBackground(Color.a);
             if(i>=colors.length){ i=0;}
       } 
    }, 0,1000);//从0秒开始,每隔1秒执行一次这个程序怎么有错误啊?此时a不能用吗?为什么?如果用red代替a就对了,这究竟是怎么回事啊?