get Random Bright Color - Java 2D Graphics

Java examples for 2D Graphics:Color Light

Description

get Random Bright Color

Demo Code


//package com.java2s;
import java.awt.*;

public class Main {
    public static void main(String[] argv) throws Exception {
        int lowerLimit = 2;
        System.out.println(getRandomBrightColor(lowerLimit));
    }/* www .  j a v a 2s.  c o m*/

    public static Color getRandomBrightColor(int lowerLimit) {
        int range = 240 - lowerLimit;
        int red = (int) (Math.random() * range);
        int green = (int) (Math.random() * range);
        int blue = (int) (Math.random() * range);
        return new Color(lowerLimit + red, lowerLimit + green, lowerLimit
                + blue);
    }
}

Related Tutorials