Java Random Color getRandomColor()

Here you can find the source of getRandomColor()

Description

get Random Color

License

Open Source License

Declaration

private static Color getRandomColor() 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.*;

import java.util.*;

public class Main {
    private static Color getRandomColor() {
        Random rand = new Random();
        // Java 'Color' class takes 3 floats, from 0 to 1.
        float r = rand.nextFloat();
        float g = rand.nextFloat();
        float b = rand.nextFloat();
        Color randomColor = new Color(r, g, b);
        return randomColor;
    }/*from  www. ja  va2 s.  co m*/
}

Related

  1. getRandColor(int fc, int bc)
  2. getRandColor(int fc, int bc)
  3. getRandom()
  4. getRandomColor()
  5. getRandomColor()
  6. GetRandomColor()
  7. getRandomColor()
  8. getRandomColor()
  9. getRandomColor()