skip to main | skip to sidebar

Thursday, November 15, 2012

Creating java.awt.Color instance using hex color codes

Most of you are familiar with java.awt.Color constructor which takes the RGB values to create its instance, but java.awt.Color class also allows one to create its instances using hex color codes through very less known static method ‘Color.decode(String)’.

Color obj = Color.decode("#006699");

Very simple isn’t it.

No comments:

Post a Comment