Java 8 RGBColor - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 RGBColor class.

This code example shows how to use the following methods:getBlue, getGreen, getRed
     * 
     * @param rgbcol  PARAM 
     * @return        Returns 
     */ 
    public static Color rgbToColor( RGBColor rgbcol ) {
        return new java.awt.Color( rgbcol.getRed().getFloatValue( CSSPrimitiveValue.CSS_NUMBER ) / 255f,
                rgbcol.getGreen().getFloatValue( CSSPrimitiveValue.CSS_NUMBER ) / 255f,
                rgbcol.getBlue().getFloatValue( CSSPrimitiveValue.CSS_NUMBER ) / 255f );
    } 
}// end class 
 
/* 
 * $Id$ 
 * 
 * $Log$ 
 * Revision 1.3  2005/01/29 20:22:23  pdoubleya 
 * Clean/reformat code. Removed commented blocks, checked copyright. 
 * 
 * Revision 1.2  2004/10/23 13:30:42  pdoubleya 
 * Re-formatted using JavaStyle tool. 
6
CodeRank
This code example shows how to use the following methods:getBlue, getGreen, getRed
 
	public static String getCSSRGBColorKey(RGBColor rgbColor) {
		if (rgbColor == null) {
			return null; 
		} 
		String rgb = ((int) rgbColor.getGreen().getFloatValue(
				CSSPrimitiveValue.CSS_NUMBER))
				+ "_"; 
		rgb += ((int) rgbColor.getRed().getFloatValue(
				CSSPrimitiveValue.CSS_NUMBER))
				+ "_"; 
		rgb += ((int) rgbColor.getBlue().getFloatValue(
				CSSPrimitiveValue.CSS_NUMBER))
				+ ""; 
		return rgb;
	} 
 
	public static String getCSSFontPropertiesKey(
			CSS2FontProperties fontProperties) {
		return fontProperties.getFamily() + "_" + fontProperties.getSize()
5
CodeRank
This code example shows how to use the following methods:getBlue, getGreen, getRed
	 
	private Color getColor(CSSValue value, Color defaultValue) {
		if( value instanceof RGBColor ) {
			RGBColor rgbValue = (RGBColor) value;
			RGB rgb = new RGB(
					Integer.parseInt(rgbValue.getRed().getCssText()), 
					Integer.parseInt(rgbValue.getGreen().getCssText()),
					Integer.parseInt(rgbValue.getBlue().getCssText()));
			return new Color(control.getDisplay(), rgb);
		} else if( value != null ) {
			try { 
				Color c = (Color) cssEngine.convert(value, Color.class, control.getDisplay());
				// Create a copy because we are disposing this colors!!! 
				return new Color(control.getDisplay(),c.getRed(),c.getGreen(),c.getBlue());
			} catch (Exception e) {
			} 
		} 
		 
		 
		return defaultValue;
5
CodeRank
See Code Examples for Java 8 RGBColor Methods: