vendredi 17 mars 2017

Random color repeating

Color color[]={Color.YELLOW,Color.MAGENTA,Color.BLACK,new Color(0x964B00),new Color(0xB57EDC)};

                        Random rand=new Random();
                        Color newColor = color[rand.nextInt(5)];

                        for(int i=0;i<5;i++){
                            if(newColor.equals(color[i]));{
                                newColor=color[rand.nextInt(5)];}
                                myPanel.colorArray[myPanel.mouseDownGridX][myPanel.mouseDownGridY] = newColor;
                                myPanel.repaint();}




Aucun commentaire:

Enregistrer un commentaire