java generate random "light" color only -


i need set jpanel background light colors in order not cover text (in bold black).

at moment have this:

import java.util.random;  ....  private random random = new random(); private jpanel panel = new jpanel(); panel.setbackground( new color( random.nextint() ) ); 

but generates "any" random color. how can that?

thanks

color has constructor takes 3 values red, green , blue. if give each of them random value 100 or 255, light colors.

the usage of hsb system might give better results, e.g. new color(color.hsbtorgb((float) math.random(), (float) math.random, 0.5f + ((float) math.random())/2f));


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -