Here you can find the source of randomColor()
public static Color randomColor()
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.awt.*; public class Main { public static Color randomColor() { return new Color(randomColorValue(), randomColorValue(), randomColorValue()); }//from w w w .j ava 2s . c o m private static int randomColorValue() { return (int) (Math.random() * 255); } }