jeudi 2 mars 2017

Color object using a call to the Color.rgb method

I'm doing a project at the moment and one of the steps says to...

"The stroke color of each square should be determined by a call to your getRandomColor method. That method should create a Color object using a call to the Color.rgb method, passing in three random values in the range 0 to 255."

At them moment this is what I have...

public void getRandomColor()

{ 
    int R  = randomGenerator.nextInt();
    int G = randomGenerator.nextInt();
    int B = randomGenerator.nextInt();

    Color randomColor = new Color(R, G, B);

}

I realize it's probably wrong, I'm very new to Java. I just want to know how I would go about create a Color object using a call to the Color.rgb method, passing in three random values in the range 0 to 255




Aucun commentaire:

Enregistrer un commentaire