Here you can find the source of getColorValue(Element element, Object constant)
Parameter | Description |
---|---|
element | RTF-Element |
constant | Constant (e.g StyleConstants.Foreground) |
public static Color getColorValue(Element element, Object constant)
//package com.java2s; //License from project: Open Source License import java.awt.Color; import javax.swing.text.AttributeSet; import javax.swing.text.Element; public class Main { /**// www . j av a 2 s . com * Gets a integer value of an attribute (e.g. StyleConstants.FontFamily) * * @param element * RTF-Element * @param constant * Constant (e.g StyleConstants.Foreground) * * @return Value, null otherwise */ public static Color getColorValue(Element element, Object constant) { AttributeSet attributes = element.getAttributes(); Object obj = attributes.getAttribute(constant); if (obj == null) return null; return (Color) obj; } }