Here you can find the source of makeRandomColor()
public static Color makeRandomColor()
//package com.java2s; /**/* ww w . j a va 2s .c o m*/ * <p> * Utilities for picking good colors, taken from various websites who claim to have good knowledge of colors * (such as Munsell or ColorBrewer). * </p> * <p> * <span class="BSDLicense"> This software is distributed under the <a * href="http://hci.stanford.edu/research/copyright.txt">BSD License</a>. </span> * </p> * * @author <a href="http://graphics.stanford.edu/~ronyeh">Ron B Yeh</a> (ronyeh(AT)cs.stanford.edu) * @date Mar 17, 2004 Original Version * @date April 25, 2007 Cleaned Up and Included in R3 */ import java.awt.Color; public class Main { /** * @return a totally random :) Color */ public static Color makeRandomColor() { int R = (int) Math.round(Math.random() * 255); int G = (int) Math.round(Math.random() * 255); int B = (int) Math.round(Math.random() * 255); return new Color(R, G, B); } }