Skip to content
Snippets Groups Projects
Commit 1abc5c20 authored by dragapsy's avatar dragapsy
Browse files

Corection de la methode Color nextColor(Cell cell).

parent 0a5c4ac6
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,8 @@ import java.util.Random;
public class UniformColorGenerator implements ColorGenerator{
private Color color;
//code of color generator found on stackOverFlow;
// link : https://stackoverflow.com/questions/4246351/creating-random-colour-in-java
// but the color constructor with 3 parameter is not public, so I checked in the documentation of Color, and
......@@ -13,13 +15,15 @@ public class UniformColorGenerator implements ColorGenerator{
// Link of the doc : https://docs.oracle.com/javase/8/javafx/api/javafx/scene/paint/Color.html
@Override
public Color nextColor(Cell cell) {
Random rand = new Random();
double red = rand.nextFloat();
double green = rand.nextFloat();
double blue = rand.nextFloat();
double opacity=rand.nextFloat();
Color randomColor = new Color(red, green, blue,opacity);
cell.setColor(randomColor);
return randomColor;
// Random rand = new Random();
// double red = rand.nextFloat();
// double green = rand.nextFloat();
// double blue = rand.nextFloat();
// double opacity=rand.nextFloat();
// Color randomColor = new Color(red, green, blue,opacity);
// cell.setColor(randomColor);
// return randomColor;
return this.color;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment