color To Hex - Java 2D Graphics

Java examples for 2D Graphics:Color HEX

Description

color To Hex

Demo Code


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

public class Main {
    public static String colorToHex(Color color) {
        return String.format("#%02X%02X%02X%02X", color.getAlpha(),
                color.getRed(), color.getGreen(), color.getBlue());
    }//w w  w .jav a  2 s . co  m
}

Related Tutorials